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.

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

what do the 'c' and 'v' in argc and argv stand for?

1176


How do you override a defined macro?

1273


What is the need of structure in c?

1126


What is main () in c?

1075


What is getch () for?

1240


What is the difference between %d and %i?

1100


Array is an lvalue or not?

1130


Explain what is a static function?

1111


Why should I use standard library functions instead of writing my own?

1274


What is static memory allocation? Explain

1100


What is identifier in c?

1015


What are the advantages of union?

1071


What does s c mean on snapchat?

1115


Why do we use static in c?

1137


What does it mean when a pointer is used in an if statement?

1109