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
what do the 'c' and 'v' in argc and argv stand for?
How do you override a defined macro?
What is the need of structure in c?
What is main () in c?
What is getch () for?
What is the difference between %d and %i?
Array is an lvalue or not?
Explain what is a static function?
Why should I use standard library functions instead of writing my own?
What is static memory allocation? Explain
What is identifier in c?
What are the advantages of union?
What does s c mean on snapchat?
Why do we use static in c?
What does it mean when a pointer is used in an if statement?