Thread: was previously implicitly declared to return `int'

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    23

    was previously implicitly declared to return `int'

    I keep getting the error `GetCPUType' was previously implicitly declared to return `int'. I can't figure out what I'm doing wrong. Here is my code.

    Code:
    // this is in my main method.
    printf("CPU Type: %s \n", GetCPUType());
    
    //then my sub
    char * GetCPUType()
    // in end it does
    return CPUType;
    Thank you!

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Make sure the function prototype precedes any call to that function, otherwise it will implicitly be declared as returning int (C90).
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can I make this code more elegant?
    By ejohns85 in forum C++ Programming
    Replies: 3
    Last Post: 04-02-2009, 08:55 AM
  2. New string functions
    By Elysia in forum C Programming
    Replies: 11
    Last Post: 03-28-2009, 05:03 AM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. C++ FTP class won't work
    By lord mazdak in forum C++ Programming
    Replies: 8
    Last Post: 12-18-2005, 07:57 AM
  5. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM