extern char *

ext.c:

char arr[] = "Hello";    

main.c:

#include <stdio.h>  
#include <stdlib.h>  

extern char * arr;  

int  
main(int argc, char **argv) {  
    fprintf(stdout, "%.4s\n", (char *)&arr);  
    return EXIT_SUCCESS;  
}    

程序输出:Hell
如果printf arr,会crash。正确的extern方法是:

extern char arr[];