Compile error C2447

This is a discussion on Compile error C2447 within the C Programming forums, part of the General Programming Boards category; Hello, I wrote a sample program to help me answer a homework question. I've gotten this error a few times ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    3

    Compile error C2447

    Hello,

    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?


    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,

    Darren

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    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
    cwr
    cwr is offline
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    868
    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 Cprogramming.com
    Replies: 3
    Last Post: 01-02-2007, 01:37 PM
  2. Compile as you type
    By Rocketmagnet in forum A Brief History of Cprogramming.com
    Replies: 33
    Last Post: 12-07-2006, 12:36 PM
  3. How to compile mfc libs from platform sdk
    By tjcbs in forum Windows Programming
    Replies: 6
    Last Post: 11-19-2006, 07:20 AM
  4. Compile crashes certain windows
    By Loduwijk in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2006, 08: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, 01:58 PM

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