
April 16th, 2004, 07:36 PM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 26
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
PROBLEM WITH for loop & structure
i have to write problem that use a hash table and i have to make all id in the sturcture data equal 0
Code:
#include <stdio.h>
typedef struct {
char name [20];
int ID,year;
char major [4];
float GPA;
}data;
/************************* Main FUNCTION ********************************/
int id,num=0;
int i,d;
data a[100];
for(i=0;i<100;i++)// error wHY ??
a[i].ID =0;
// Error WHy?
do {
printf(" \n Welcome in the student data base \n\n");
printf("\n\t\t\t 1. Add new student ");
printf("\n\t\t\t 2. Update student ");
printf("\n\t\t\t 3. Display student ");
printf("\n\t\t\t 4. Quit ");
printf("\tWhat are you like to do choice (1-4) : ");
scanf (" %d", &d);
}while (d!=5 && num <31);
where is the wrong ?? i don`t see where the problems ?
|