Hello everyone,
I am somewhat new to C programming (I started last year) and I'm fairly good at it so far...that is, until I've recently started working with structures.
In my current program, I'm simply trying to initialize a simple array of structures that will be the test template for other similar programs I plan on using in the future. The program is as follows:
=============== =============== =============== ============
=============== =============== =============== ============
For each line where I'm trying to initialize each index of the schedule array, the
compiler gives me a warning and I can't figure out why.
To test to see if my code was correct or not, I used a simple printf( ) statement, and all I got for the output was zero, so I'm obviously doing something wrong here. Can anyone help? I'd really appreciate it--thanks!
RICH
I am somewhat new to C programming (I started last year) and I'm fairly good at it so far...that is, until I've recently started working with structures.
In my current program, I'm simply trying to initialize a simple array of structures that will be the test template for other similar programs I plan on using in the future. The program is as follows:
=============== =============== =============== ============
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"}};
printf("%d\n", schedule[0].arrive[0]);
return 0;
}
For each line where I'm trying to initialize each index of the schedule array, the
compiler gives me a warning and I can't figure out why.
To test to see if my code was correct or not, I used a simple printf( ) statement, and all I got for the output was zero, so I'm obviously doing something wrong here. Can anyone help? I'd really appreciate it--thanks!
RICH
Comment