Hello everyone,
Well, it seems my struggles with structures have continued. Shortly after getting my code to work, I wanted to pass the entire structure into a function. Trouble is, I want to use a typedef as described below:
=============== =============== =============== ===
=============== =============== =============== ==
And here is how I wanted to call my function:
=============== =============== =============== ==
=============== =============== =============== ==
This time, I get an error that says "Undefined symbol find_departure" , meaning there's something wrong with my find_departure function. Here is my function prototype:
=============== =============== =============== ==
=============== =============== =============== =
Is there a fix to this? (By the way, 'FLIGHTS' is a macro defined in my header file standing for the integer value '8'. Also, I hope I don't get flamed for making a new thread, but I thought this topic was rather different than the issue I posted earlier this morning.)
Thanks.
RICH
Well, it seems my struggles with structures have continued. Shortly after getting my code to work, I wanted to pass the entire structure into a function. Trouble is, I want to use a typedef as described below:
=============== =============== =============== ===
Code:
typedef struct
{
int depart [FLIGHTS];
int arrive[FLIGHTS];
const char *attendant;
} flight; /*flight is now a new structure type*/
And here is how I wanted to call my function:
=============== =============== =============== ==
Code:
#include <stdio.h>
int main(int argc, char *argv[])
{
int time, closest;
struct flight
{
int depart[FLIGHTS];
int arrive[FLIGHTS];
char *attendant;
};
struct flight schedule[] =
{{800}, {1016}, "Jason Mackenzie"},
{{943}, {1152}, "Valerie Woods"},
{{1119}, {1331}, "Antonio Vasquez"},
{{1247}, {1500}, "Natalie McIver"},
{{1400}, {1608}, "Scott Curtis"},
{{1545}, {1755}, "Yvonne Vogelar"},
{{1900}, {2120}, "Mitch Matthews"},
{{2145}, {2358}, "Marcie Maddox"}};
closest = find_departure(time, schedule);
return 0;
}
This time, I get an error that says "Undefined symbol find_departure" , meaning there's something wrong with my find_departure function. Here is my function prototype:
=============== =============== =============== ==
Code:
int find_departure(int time, flight schedule[]);
Is there a fix to this? (By the way, 'FLIGHTS' is a macro defined in my header file standing for the integer value '8'. Also, I hope I don't get flamed for making a new thread, but I thought this topic was rather different than the issue I posted earlier this morning.)
Thanks.
RICH
Comment