#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
long aa = 123;
long aaa = &aa;
// warning: initialization of ‘long int’ from ‘long int *’ makes integer from pointer without a cast
// 这里,编译器会识别出来&ff是 'long int *', 不是 ‘long int’
long * bb = &aa;
long ** cc = &bb;
long *** dd = &cc;
long **** ee = ⅆ
long ***** ff = ⅇ
long * gg = &ff;
// warning: initialization of ‘long int *’ from incompatible pointer type ‘long int ******’
// 这里,编译器会识别出来&ff是 'long int ******', 不是 ‘long int *’
printf("\naa: %ld",aa);
printf("\naaa: %ld",aaa);
// aaa 存进取的是指针, 但是声明为long int, 所以这里直接打印为%ld没有任何错误。
printf("\nbb: %ld",bb);
printf("\ncc: %ld",cc);
printf("\ndd: %ld",dd);
printf("\nee: %ld",ee);
printf("\nff: %ld",ff);
// warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘long int *****’
// 这些全都被警告,因为都是指针,不能当作%ld输出
printf("\ngg: %ld",(long)(gg));
// 这里gg也是指针,但是被转换类型后也没问题。
puts("\n\n");
return 0;
}
标签:aa,ld,int,多级,long,C语言,ff,printf,指针
From: https://www.cnblogs.com/etfolinbase/p/17605592.html