All pastes #418800 Raw Edit

Mine

public c v1 · immutable
#418800 ·published 2007-03-31 20:55 UTC
rendered paste body
#include <stdio.h>#define total 5struct cars {       int age;       int mileage;       char owner[5];       };//Trying to make an array of car structures. But on the third run through the age input it crashes.//Try a,1,2   b,1,2,  c,1,2, it will crash on last 1int main(){       int counter = 0;       int done ;        struct cars cararray[counter];       while (counter != total) {              printf("Type the Owner name for this car\n");              scanf("%s", &cararray[counter].owner);              printf("Type the year of the car\n");              scanf("%d", &cararray[counter].age);              printf("Type the # of the miles on the car\n");              scanf("%d", &cararray[counter].mileage);               printf("Owner: = %s,  Age: = %d, Mileage: = %d\n", cararray[counter].owner,  cararray[counter].age, cararray[counter].mileage);                counter++;              }       return 0;       }