Syntax Error Before ';' Token

This is a discussion on Syntax Error Before ';' Token within the C Programming forums, part of the General Programming Boards category; << Split from dead thread - please start new threads rather than bumping threads months or years old >> I ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    2

    Syntax Error Before ';' Token

    << Split from dead thread - please start new threads rather than bumping threads months or years old >>

    I am a beginner. My first program gives me the following error:

    "syntax error before '.' token"

    My program is:
    Code:
    #include <stdio.h>
    
    int.main()
    {
        printf("goodbye,cruel world!\n");
        return(0);
    }
    Any help would be greatly appreciated!

    Thanks
    Mike

  2. #2
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,657
    Code:
    int.main()
    Why do you have a . in there? A function signature is as follows:

    Code:
    return_datatype function_name(function_arguments)
    which in the case of main is:
    return_datatype = int
    function_name = main
    function_arguments = (void) or (int argc, char *argv[])

  3. #3
    Registered User
    Join Date
    Dec 2010
    Posts
    2
    I removed the "." and it fixed the error.

    Thank you so much!

    Mike

  4. #4
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by Mike4 View Post
    << Split from dead thread - please start new threads rather than bumping threads months or years old >>

    I am a beginner. My first program gives me the following error:

    "syntax error before '.' token"

    My program is:
    [code]
    printf("goodbye,cruel world!\n");
    A bit off topic but are you always bursting with such gigantic levels of enthusiasm ?
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,848
    Meh filled with more Meh.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what am I missing? (Program won't compile)
    By steals10304 in forum C Programming
    Replies: 3
    Last Post: 08-25-2009, 04:01 PM
  2. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 09:26 AM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM

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