Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3.                             Online C Compiler.
  4.                 Code, Compile, Run and Debug C program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <stdio.h>
  10. int a = 20;
  11. void functie(){
  12.     printf("Variabila globala: %d\n", a);
  13. }
  14.  
  15. int main()
  16. {
  17.     //scope 1
  18.     int a = 7;
  19.     functie();
  20.     {
  21.         // scope 2
  22.         a = 5;
  23.         printf("In scope-ul 2: %d\n", a);
  24.         functie();
  25.     }
  26.    
  27.     printf("In scope-ul 1: %d\n", a);
  28.     functie();
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement