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
Should a function contain a return statement if it does not return a value?
What is meant by inheritance?
Write a program for Overriding.
Do you have any idea how to compare array with pointer in c?
What is an endless loop?
What is the maximum no. of arguments that can be given in a command line in C.?
What is the use of getchar() function?
Find MAXIMUM of three distinct integers using a single C statement
When should we use pointers in a c program?
what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?
What are enumerated types?
How can I get random integers in a certain range?
Explain the advantages and disadvantages of macros.
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
Explain what is the benefit of using #define to declare a constant?