Monday, 18 March 2013

Solution: Access Variables in Different C files

To access variables in different C files, check below example

extern int a;

int a;
a = 20;

printf("a value is %d",a);

Note: if you compile individual file and check then you may get error 
Compile like:
gcc file1.c file2.c -o out
Output: a value is 20

Share This!

No comments:

Post a Comment

Here We Write The Problems we face at different situations and Solutions to those problems.