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

    Join Date
    Jul 2013
    Posts
    30
    Rep Power
    2

    Using ";" in my functions


    void nothing(int a, int b; int c, int d);

    In here, I get an error about the ";" inside the brackets. Why can't I do that just like the for loop statement?
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,648
    Rep Power
    4248
    Because the C syntax doesn't define it that way. The ; is a code statement terminator, not a statement separator.

    Want to argue about it, take it up with Ken Thompson and Dennis Ritchie.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,997
    Rep Power
    481
    Processing your source with bash command
    tr \; , < program.c.pre > program.c
    before submission to the compiler will fix this problem.

    Comments on this post

    • eramit2010 agrees : :)
    [code]Code tags[/code] are essential for python code and Makefiles!
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    26
    Rep Power
    0
    because for loop has three statements that are combined in one line and to seperate them the c compiler supports ; to seperate them.but a function prototype you use comma as a seperateor
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    India
    Posts
    95
    Rep Power
    4
    it's same kind of question u have already asked.

IMN logo majestic logo threadwatch logo seochat tools logo