Advertisement
campos20

Untitled

Jun 2nd, 2020
1,013
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. //
  5. // Autor Alexandre Campos
  6.  
  7. // Variavel global
  8. int numero = 5;
  9.  
  10. int funcao(){
  11.  
  12.     printf("Numero: %d\n", numero);
  13.  
  14.     return 0;
  15. }
  16.  
  17. int main()
  18. {
  19.     int numero = 3;
  20.  
  21.     {
  22.         // Vai chamar a variavel global
  23.         extern int numero;
  24.  
  25.         printf("Numero: %d\n", numero);
  26.     }
  27.  
  28.     // Exibe o numero do escopo da funcao main
  29.     printf("Numero: %d\n", numero);
  30.  
  31.     // Chamada da funcao
  32.     funcao();
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement