SHARE
TWEET

Untitled

campos20 Jun 2nd, 2020 835 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top