I need the program to have a pointer to the Account overdue[13]; I going to use it in the function that have not writen yet. But I try to make a pointer to the Account overdue[13] in main so I can use that data that is store in it in a function. Can you please help me. How do I write a pointer to overdue[13] becouse it hase difrent data types, i just cant sat int *ptr becouse i have int, floats, char in the structure. Basically i needa point for the data in the structure.
#include <stdio.h>
typedef struct {
char Name[21];
int acct_num;
float bal;
float limit;
}Account;
int main()
{
Account overdue[13];
int q = 0, n = 1, counter2 = 1 ;
int AccountNumber = 0 ;
float Purchase = 0;
FILE *junk ;
junk = fopen("d:\\c\\files\\acct9.dat","rb");
if(junk == NULL)
fprintf(stderr,"You screw up\n");
else{
fread(&overdue[n], sizeof(Account),1,junk);
while(!feof(junk))
{
printf("%s %d %.2f %.2f\n",overdue[n].Name ,overdue[n].acct_num,
overdue[n].bal, overdue[n].limit);
n++ ;
fread(&overdue[n], sizeof(Account),1,junk);
}
printf( "Enter Account Number: " );
scanf( "%d", &AccountNumber );
/*
printf( "Enter amount of purchase: " );
scanf( "%2f", &Purchase ); */
while ( counter2 <= n )
{
if(overdue[counter2].acct_num == AccountNumber)
{
printf("Account Found\n\n");
printf("%s %d %.2f %.2f\n",overdue[counter2].Name ,
overdue[counter2].acct_num, overdue[counter2].bal,
overdue[counter2].limit) ;
break;
}
counter2++ ;
}
}
fclose(junk);
return 0 ;
}