Results 1 to 2 of 2

Thread: Urgent: C Variable scope

  1. #1
    needaname16
    Guest

    Exclamation Urgent: C Variable scope

    Hi Everyone,

    I have a multiple source file C program, that contains header files for global variables. When I create a header file using static declaration it compiles and links ok, however the scope is wrong because the variable changes value according to what it last was in the current C file not the new value changed in the last C file.

    I tried to make the static declaration in the main procedure then create extern references in the other c source files however the linker is unable to resolve the extern references.

    Does anyone have a suggestion on how to get a global variable to have scope over multiple c files.

    In anticipation of the reply
    Thanks a million

  2. #2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width