InidBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming Java Programming
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Group Disucssion HR Interview Questions Technical Interview Questions Body Language
"I never see what has been done; I only see what remains to be done."
- Marie Curie

C Programming - Declarations and Initializations - Discussion

@ : Home > C Programming > Declarations and Initializations > General Questions - Discussion
8. 

Is the following statement a declaration or definition?
extern int i;

[A].
Declaration
[B]. Definition
[C]. Function[D]. Error

Answer: Option A

Explanation:

Declaring is the way a programmer tells the compiler to expect a particular type, be it a variable, class/struct/union type, a function type (prototype) or a particular object instance. (ie. extern int i)

Declaration never reserves any space for the variable or instance in the program's memory; it simply a "hint" to the compiler that a use of the variable or instance is expected in the program. This hinting is technically called "forward reference".


Antony said: (Sat, Jun 12, 2010 01:28:49 PM)    
 
what actually here mean by " extern"

Venki said: (Mon, Jun 28, 2010 09:25:59 PM)    
 
extern here refers to type of storage class in c . If you have 2 files say A and B and you want to access the global variable declared in A to be appearing in B then u culd do so by adding extern keyword . Refer to google if not satisfied .

Ramgopalreddy said: (Wed, Jul 21, 2010 11:37:09 PM)    
 
it is nice job.........

Rahul said: (Sat, Aug 7, 2010 12:55:08 PM)    
 
why we use extern keyword?

Sagarborse said: (Tue, Aug 31, 2010 05:59:39 PM)    
 
When we are declaring any function after main() function then we declare it before its use which is declaration

and what that method is going to invoke that code is its definition

Example:

void show(); //Declaration
void main(){
show(); //Call to method
}
void show(){ //Definition
printf("Hello!");
}

But what is declaration and definition in context of Variable?

Write your comments here:


© 2008-2010 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy