几个小时以来,我一直试图弄清楚这一点,这让我有点发疯。执行程序时不断出现分段错误,我该如何解决?我也收到警告“尝试从不同大小的整数中指向指针”,但是当我使用强制转换 (int *) 时,我仍然收到警告。请帮助...这是代码:
int address, length, i;
int * p = malloc(sizeof(int));
printf("Please enter <address> <length>\n");
scanf("%x %d", &address, &length);
p = (int *) address;
for (i=0; i<length;i++){
printf( "%02x ", p[i] );
}