Jump to content
ELFORUM - Forumul electronistilor

intrebare despre variabile globale


vlad_2770

Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • vlad_2770

    2

  • psanyi

    2

Popular Days

Top Posters In This Topic

cum pot face ca o variabila globala dintr-un fisier sursa sa fie vazuta si in alte fisiere sursa? am incercat cu extern in fata si nu merge.multumesc

Banuiesc ca te referi la C/C++. Se face cu cuvantul cheie extern dar sursa .c in care este declarata trebuie sa fie deja compilata sub forma de obiect.ex:sursa1.c
unsigned short int var_globala  = 0; /*declara  var globala*/int foo(bar){                   /* definire functie */         var_globala = x;          ...         return 0 }
sursa2.c
extern unsigned short int var_globala;int foo(bar){   var_globala = y;   ....   return 0;}
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines