pointer to array of structs
Nedenstående program udskriver alle 100 records.Hvilken pointer type skal der bruges i den kommenterede linie??
Mvh smackers
===================
#include <stdio.h>
struct record {
char name[30];
char company[40];
char address[50];
int acctno;
float balance;
}customer[100];
int main(void) {
int i;
struct record[] * ptr; // virker ikke
//struct customer * ptr
//struct customer[] *ptr
for (i = 0; i < 100; i++) {
ptr = customer[i];
printf("Name: %s, Company: %s, Address: %s\n", ptr->name, ptr->company, ptr->address);
printf("Account no.: %d, Balance: %f\n", ptr->acctno, ptr->balance);
}
getchar();
return 0;
}