was previously implicitly declared to return `int'

This is a discussion on was previously implicitly declared to return `int' within the C Programming forums, part of the General Programming Boards category; I keep getting the error `GetCPUType' was previously implicitly declared to return `int'. I can't figure out what I'm doing ...

  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,006
    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, 12:03 PM
  4. C++ FTP class won't work
    By lord mazdak in forum C++ Programming
    Replies: 8
    Last Post: 12-18-2005, 06:57 AM
  5. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM

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