You are here:

C/diff b/w global and extern

Advertisement


Question
Is any difference there b/w global and extern variable, if it there can u explain?

Answer
First of all there is no keyword called "global".
extern keyword will tell the compiler that the definition of this variable is made somewhere else and you can use this declaration for your information.
And this variable has to be global (means declared outside main function). Otherwise, extern will be of no use.

So, global and extern are not same.

-Narendra

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.