RE: [Dev-C++] newbie function_struct_array problem
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Stanley <sms...@iw...> - 2004-05-16 23:50:26
|
> --- On Fri 05/14, Dane Ensign < DE...@pa... > wrote: > From: Dane Ensign [mailto: DE...@pa...] > Subject: [Dev-C++] newbie function_struct_array problem > <skip> > Im having trouble getting my assignment program to compile. There > is something incorrect between the function prototype, > function call, and function headerline. But I cant figure it out. > <skip> > void CreateEmployee (struct [], int); //prototype That line should be: void CreateEmployee( struct Employee[], int); //prototype A struct keyword by itself doesn't mean anything to the compiler. You have to follow it with an already defined struct name. Another problem is that you use the name struct Employee in your function, but you never define a struct Employee. You define a struct Emp, perhaps that should be struct Employee? Also, you'll need to move the definition of the struct before the definition of the prototype in order for the prototype to work. Some rules of thumb: Your prototype and function definition should be nearly identical. Usual order of program files: #include's constant defintions (#defin or const) Structure declarations/typedefs Function prototypes Code Hope this helps. Stanley _______________________________________________ |