Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- beyond@rules->$ cat global.c
- #include<stdio.h>
- #include<stdlib.h>
- int x=5;
- void foo(int x,int y)
- {
- x=y;
- printf("%d %d\n",x,y);
- }
- int main()
- {
- foo(2,3);
- return 0;
- }
- beyond@rules->$ gcc -Wall -W global.c -o global
- beyond@rules->$ rm global
- beyond@rules->$ gcc -Wshadow -Wall -W global.c -o global
- global.c: In function ‘foo’:
- global.c:6:14: warning: declaration of ‘x’ shadows a global declaration [-Wshadow]
- global.c:4:5: warning: shadowed declaration is here [-Wshadow]
- beyond@rules->$ ^C
- beyond@rules->$
Advertisement
Add Comment
Please, Sign In to add comment