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 |
How the processor registers can be used in C ?
How does free() know explain how much memory to release?
Write a code to remove duplicates in a string.
How many levels of indirection in pointers can you have in a single declaration?
0 Answers Agilent, ZS Associates,
what is difference between C and C++
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
Is it valid to address one element beyond the end of an array?
How to find the usage of memory in a c program
Write a program to accept a character & display its corrosponding ASCII value & vice versa?
What are the advantages of using new operator as compared to the function malloc ()?
cavium networks written test pattern ..
What do you mean by a local block?