Advertisement
Guest User

Untitled

a guest
Sep 5th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void){
  4.     printf("%s\n", a);
  5.     return 0;
  6. };
  7. -------main.c---------
  8. #include <stdio.h>
  9.  
  10. extern char a[] = "hello world";
  11. ------a.c-------
  12. gcc main.c a.c
  13. -->
  14. segment.c: In function ‘main’:
  15. segment.c:4:17: error: ‘a’ undeclared (first use in this function)
  16.   printf("%s\n", a);
  17.                  ^
  18. segment.c:4:17: note: each undeclared identifier is reported only once for each function it appears in
  19. a.c:3:13: warning: ‘a’ initialized and declared ‘extern
  20.  extern char a[] = "hello world";
  21.              ^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement