Guest User

Untitled

a guest
Aug 21st, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. Why its returning an error?
  2. #include <stdio.h>
  3. int call()
  4. {
  5. extern int b;
  6. b=10;
  7. printf("%d",b);
  8. }
  9.  
  10. int main ()
  11. {
  12. int b=8;
  13. call();
  14. return 0;
  15. }
  16.  
  17. /tmp/ccAsFhWX.o:meka.c:(.text+0x7): undefined reference to `_b' collect2: ld returned 1 exit status
  18.  
  19. #include <stdio.h>
  20.  
  21. static int b;
  22.  
  23. int call()
  24. {
  25. b=10;
  26. printf("%d",b);
  27. }
  28.  
  29. int main ()
  30. {
  31. b=8;
  32. call();
  33. return 0;
  34. }
  35.  
  36. #include <stdio.h>
  37.  
  38. extern int b;
  39.  
  40. void call()
  41. {
  42. b = 10;
  43. printf("%dn",b);
  44. }
  45.  
  46. int b = 8;
  47.  
  48. int main () {
  49. call();
  50. return 0;
  51. }
  52.  
  53. #include <stdio.h>
  54.  
  55. void call (int *b)
  56. {
  57. printf ("%dn", *b = 10);
  58. }
  59.  
  60. int main () {
  61. int b = 8;
  62. call (&b);
  63. return 0;
  64. }
  65.  
  66. void call (int *b) {
  67. *b = 10;
  68. printf("%d",*b);
  69. }
Add Comment
Please, Sign In to add comment