Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how can we Declare a variable in c without defining it.



how can we Declare a variable in c without defining it...

Answer / manoj

By using EXTRN.
Example:
File 1:

int GlobalVariable; // implicit definition
void SomeFunction(); // function prototype
(declaration)

int main() {
GlobalVariable = 1;
SomeFunction();
return 0;
}

File 2:

extern int GlobalVariable; // explicit declaration

void SomeFunction() { // function header (definition)
++GlobalVariable;
}

Is This Answer Correct ?    6 Yes 1 No

Post New Answer

More C Interview Questions

What do you mean by keywords in c?

0 Answers  


main() { int a[10]; printf("%d",*a+1-*a+3); }

2 Answers  


What does 2n 4c mean?

0 Answers  


find second largest element in array w/o using sorting techniques? use onle one for loop.

15 Answers   BitWise, Zycus Infotech,


What's wrong with "char *p = malloc(10);" ?

4 Answers  


What is the use of linkage in c language?

0 Answers  


What is pointer and structure in c?

0 Answers  


What is "Hungarian Notation"?

0 Answers   Celstream,


What are the different types of storage classes in C?

3 Answers  


why java is called as a purely oops language.

3 Answers   TVS,


main() { char *ptr = "Ramco Systems"; (*ptr)++; printf("%s\n",ptr); ptr++; printf("%s\n",ptr); } Find the Outputs?

9 Answers   BTBP, CitiGroup,


Go through the following code sinippet char a[20]; a="Hello Orcale Test"; will this compile?

4 Answers   Oracle,


Categories