Thread: Compile error C2447

  1. #1
    Registered User
    Join Date
    Oct 2005

    Compile error C2447


    I wrote a sample program to help me answer a homework question. I've gotten this error a few times now. What is wrong with my code?

    #include <stdio.h>
    void Mystery(int A[],int size);
    int n;
    int main(void)
    	int Mystery(100);
    	return 0;
    void Mystery(int A[],int size);
    	if(size>0){A[0]=0;Mystery(A+1, size-1);}
    	printf("%d = A[0]",A[0]);
    Thank you,


  2. #2
    Registered User
    Join Date
    Sep 2004
    There are several errors. First of all, you seem to be declaring a function instead of calling a function in your main() function. You don't include the return type to call a function. Secondly, the function Mystery() takes an array and an integer, but you are just trying to pass an integer only. Thirdly, you have a semicolon after your Mystery() function declaration which needs to be removed.

  3. #3
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Sydney, Australia
    Also, "compiler error C2447" means nothing to most of us here. Surely the compiler is producing more information than that?

    A quick google suggests the message also contains "C2447: missing function header (old-style formal list?)", which is more helpful. Next time please give the full error message and the line that it is associated with.

    Fortunately, the errors above are obvious.

    My guess is that your homework is to work out what the "Mystery" function does and explain how it works? If so, look inside the function, notice it calls itself. Why don't you set up an arbitrary array of ints and pass the array to Mystery with the correct size parameter?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C and C++ compile speed
    By swgh in forum A Brief History of
    Replies: 3
    Last Post: 01-02-2007, 02:37 PM
  2. Compile as you type
    By Rocketmagnet in forum A Brief History of
    Replies: 33
    Last Post: 12-07-2006, 01:36 PM
  3. How to compile mfc libs from platform sdk
    By tjcbs in forum Windows Programming
    Replies: 6
    Last Post: 11-19-2006, 08:20 AM
  4. Compile crashes certain windows
    By Loduwijk in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2006, 09:05 PM
  5. How can I compile C or C++ with Visual Studio .NET?
    By Dakkon in forum C Programming
    Replies: 8
    Last Post: 02-11-2003, 02:58 PM