Simple doubt on declaration

This is a discussion on Simple doubt on declaration within the C Programming forums, part of the General Programming Boards category; Can anyone plz give an example for this statement " a function can have many declaration but only one definition"?...

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    50

    Simple doubt on declaration

    Can anyone plz give an example for this statement " a function can have many declaration but only one definition"?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,304
    Quote Originally Posted by Saurabh Mehta
    Can anyone plz give an example for this statement " a function can have many declaration but only one definition"?
    What is a function declaration and what is a function definition? Give examples.

    Construct two programs, each of which is to have a main function that calls a function named foo: one program declares foo many times but defines it exactly once; the other defines foo multiple times. Compile both programs. What do you observe?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    50
    function foo is already defined error
    Can you plz give example on this notion?

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,666
    Quote Originally Posted by Saurabh Mehta View Post
    Can you plz give example on this notion?
    laserlight already has. Read her post carefully, and follow the advice on constructing two programs.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Sunshine, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. very simple doubt
    By scofield in forum C Programming
    Replies: 2
    Last Post: 02-04-2012, 08:52 AM
  2. Array declaration doubt
    By finalsayan in forum C Programming
    Replies: 8
    Last Post: 03-29-2010, 10:56 AM
  3. A very simple doubt
    By afser in forum C Programming
    Replies: 7
    Last Post: 10-26-2008, 03:30 PM
  4. a simple doubt!
    By chottachatri in forum C Programming
    Replies: 7
    Last Post: 10-10-2008, 02:42 PM
  5. a simple doubt in graphics
    By nikhil_trichy in forum Game Programming
    Replies: 7
    Last Post: 02-02-2006, 10:01 PM

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