which one are declarations and which one are definitions

This is a discussion on which one are declarations and which one are definitions within the C Programming forums, part of the General Programming Boards category; Assume these statements are all outside of functions. Which of the following are declarations only and which are definitions: float ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    4

    which one are declarations and which one are definitions

    Assume these statements are all outside of functions. Which of the following are declarations only and which are definitions:
    float * rate ;
    struct S ;
    static double pi;
    typedef int * string;
    node * fun(int i);
    extern double x;

    --------------------

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,566
    Let me google that for you.

    Try to do your own homework (did you read the site's homework policy?). Tell us which you think are definitions and which are declarations, and why, and we will help you where you went wrong.

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    4
    typedef int * string;
    node * fun(int i);

    are the only definition i can think off.

    Others are declarations.
    Last edited by xanli; 03-18-2011 at 11:05 AM.

  4. #4
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,566
    You failed to answer the "why" part, the part I put in bold in my post, because it's extremely important. Why do you think those two are the only definitions?

  5. #5
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,832
    I don't know what struct S ; does. If anything.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21