Thread: reoccuring conflicting types error and previous implicit declaration errors....ARGHH

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    1,012
    A compiler is not going to scan ahead for you to see what functions you may have lurking at the end of your file. If it has not seen a function declaration by the time you call the function, it simply assumes that the function returns int and takes an unspecified number of arguments. This is what your compiler is referring to as an “implicit declaration”, because that's what it is.

    Either put the order_chars() function above main(), or put a prototype for it above main(). A prototype would look something like:
    Code:
    char order_chars(char x,char y,char z);
    That's enough for the compiler to know how to properly deal with the function.

    It sounds like you're using gcc. Always use at least the -Wall option; this turns on a lot of useful (and one or two stupid) warnings.

    By the way, “return x, y, z” does not do what you (probably) think it does: it returns z, and ignores x and y. You can't return multiple values in C.

  2. #2
    Registered User
    Join Date
    Nov 2010
    Posts
    6
    Much apreciated thank you!

Popular pages Recent additions subscribe to a feed