Thread: error C2143: syntax error : missing ')' before ';'

  1. #1
    UK2
    Join Date
    Sep 2003
    Posts
    112

    error C2143: syntax error : missing ')' before ';'

    Hello,

    I am return a string from a function. Function prototype:
    Code:
    char* ToUpper(char *str, const int length);

    In my main i have the following:
    Code:
    char string2[] = "Hello how are you today?";
    strcpy(string2, ToUpper(string2, strlen(string2));
    I keep on getting the following error message.

    error C2143: syntax error : missing ')' before ';'

    Any advice would be most gratefull,

    Thanks,

  2. #2
    verbose cat
    Join Date
    Jun 2003
    Posts
    209
    Quote Originally Posted by steve1_rm View Post
    Code:
    strcpy(string2, ToUpper(string2, strlen(string2));
    error C2143: syntax error : missing ')' before ';'
    Count your parentheses. You have 3 opening but only 2 closing on that line.
    abachler: "A great programmer never stops optimizing a piece of code until it consists of nothing but preprocessor directives and comments "

  3. #3
    UK2
    Join Date
    Sep 2003
    Posts
    112
    Thanks,

    I was looking everywhere.

    A stupid mistake. I will have to look more closely next time.

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Try putting spaces at certain places to make it easier to spot where there needs to be ending ).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > strcpy(string2, ToUpper(string2, strlen(string2));
    If ToUpper() returns string2, then not only is the strcpy a waste of time, it's also undefined.

    Very few C library functions which move data around are guaranteed to do the "right thing" when the source and destination overlap. memmove() is an exception.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  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, 06:39 AM