我有这段代码,现在我正在试着调试它,我得到了这个错误:
warning: incompatible integer to pointer conversion initializing
'int *' with an expression of type 'int'; take the address with &
[-Wint-conversion]
int * b = a[1];
我正在调试的代码如下:
#include<stdio.h>
int main() {
int ii;
int a[] = {1,2,3,4,5,6};
int * b = a[1];
for (ii=0;ii<6;ii++) {
printf("%d ",*(b+ii));
}
printf("\n");
return 0;
}
发布于 2020-07-14 09:27:06
int *b;
B是一个指针,a1是一个整数...
尝试:
int *b;
*b=a[1];
这将把我们带到有趣的部分。你对此毫无记忆!
另一种方式:
int *b=(a+1);
还有另一个:
int *b=&a[1];
https://stackoverflow.com/questions/62886611
复制相似问题