Here is the code:
file.h
A.cppCode:char p[5] = "abcd";
The result is a run-time error (memory access fault, I think)Code:extern char* p;
int main(){
printf("%c",p[2]);
}
Why is that?
When I correct the A.cpp as
It does work .Code:extern char p[];
int main(){
printf("%c",p[2]);
}