x = 2;                        an assignment

area = length  * width;    an assignment

--- On Wed, 9/17/08, Robert Ryan <[EMAIL PROTECTED]> wrote:
From: Robert Ryan <[EMAIL PROTECTED]>
Subject: [c-prog] definition vs declaration
To: [email protected]
Date: Wednesday, September 17, 2008, 10:02 PM










    
            



I was wondering if someone could clarify the following for me:1.             a 
declaration but not a definition 



2.             a definition but not a declaration 



3.             a declaration and also a definition 



4.             neither a declaration nor a definition



 



 



int x;               1. declaration of an int named x



 



int x = 2;          3. a declaration and also a

definition



 



x = 2;               4. neither a declaration nor a

definition



 



const int x  = 2;     3.

a declaration and also a definition



 



extern int x;        1. a declaration but

not a definition



 



class Bad_area;    1.   a

declaration but not a definition



 



class Bad_area{  };     2.  a declaration but not a definition



 



struct date;                    1.

a declaration but not a definition



 



struct date{int d, m, y; }     3.   a

declaration and also a definition



 



// a function definition



int area(int length, int

width);     3.  a

declaration and also a definition



 



// function definition



int area(int length, int

width)  {return length * width; }



                                              3.             a declaration and 
also a definition



 



area = length  * width;              4.

neither a declaration nor a definition



 

         

        

        



        



        

        



[Non-text portions of this message have been removed]




      

    
    
        
         
        
        








        


        
        


      

[Non-text portions of this message have been removed]

Reply via email to