so what i need to do is create a function where it shows(?) the content of struct (car[]), my problem is that i dont really know how...?, im guessing i should use a pointer but im really stuck.Should i use while or for, what is the best way to do this?.( i mainly did python so u can explain it in python if u want...)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct cars{
char manufacturer[30];
char model[30];
int kub_lt;
int year;
int cost_euro;
};
struct cars car[]={
{"OPEL",
"VECTRA",
1.8,
1996,
25000},
{"FORD",
"Monteo",
1.8,
2001,
25000},
{"FIAT",
"Punto",
1.4,
2002,
12000},
{"HUNDAY",
"Atos",
1.0,
2002,
9000}
};
int main(void)
{
int i,cptr;
i=0;
while (car[i]!="\0")
printf("Manufacturer: %s\n",car[i].manufacturer);
printf("Model: %s\n",car[i].model);
printf("Kub.LT: %d\n",car[i].kub_lt);
printf("Production year : %d\n",car[i].year);
printf("Cost in euros :%d\n",car[i].cost_euro);
}