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
List some of the dynamic data structures in C?
Write a program to reverse a linked list in c.
By using C language input a date into it and if it is right?
What is a null string in c?
What is a static variable in c?
Is main is user defined function?
Is it fine to write void main () or main () in c?
Is it acceptable to declare/define a variable in a c header?
How can variables be characterized?
What is meant by type casting?
How can a number be converted to a string?
List the difference between a 'copy constructor' and a 'assignment operator' in C?
Do you know the purpose of 'register' keyword?
What is the difference between mpi and openmp?
Write programs for String Reversal & Palindrome check