关于extern的疑问
Test.c 文件
#include <stdio.h>
char* const hello;
char hello1[3]; // 这里面的hello1是char数组
void show(void) {
printf("hello:%s\n", hello);
printf("hello1:%s\n", hello1); // 输出居然是:hello1:c 这是我不理解的地方
}
#include <stdio.h>
extern char* hello;
extern char hello1; // 这里hello1是char
extern void show();
int main(void) {
hello = "abcdef";
hello1 = 'c'; // 给字符赋值
show(); // 打印
return 0;
}
hello:abcdef
hello1:c