#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2017
    Posts
    3
    Rep Power
    0

    [Q]Characters of function prototype and header


    In C programming, which two characters help the compiler determine the difference between the function prototype and the function header?
    I am completely novice and just started learning C programming.Thanks for your support, glad to be here.
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,475
    Rep Power
    1875
    Can't you compare

    Code:
    void foo(); 
    
    /// with
    
    void foo() {
    }
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2017
    Posts
    3
    Rep Power
    0
    Thank you for the response.

    #include <stdio.h> --This is the header, am I right?

    main()

    Below is the function prototype, right?
    {
    printf("Hello, World!");
    }

    The question pertains to the character differences with the semicolon and the curly brackets {} or something else? Sorry I am totally new to this stuffs and want to be enlightened.
  6. #4
  7. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,475
    Rep Power
    1875
    > #include <stdio.h> --This is the header, am I right?
    Yes

    >Below is the function prototype, right?
    No; main is a function definition, and printf is a function call.

    Comments on this post

    • grafix agrees
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2017
    Posts
    3
    Rep Power
    0
    I see, so accdng to your first reply the difference would be ; semicolon and the curly brackets {}.I supposed that would be the answer.Thank you very much Sir :)

IMN logo majestic logo threadwatch logo seochat tools logo