I am trying to use struct called BankAccount
it takes char array of name 50 letters long , int ID
, and double balance
. I am trying to use malloc()
to put it to pointer but i get this
error : void can not be assigned to an entity of type BankAccount.
typedef struct
{
char name[50];
int ID;
double balance;
} BankAccount;
FILE *fp;
BankAccount *accounts = 0;
int accountSize = 0;
// I init like this in main function
accounts = malloc(accountSize * sizeof(*accounts));
void ReadAccountData(BankAccount *accounts, FILE *fp, int arraySize)
{
int i = 0;
while (!feof && i < arraySize) {
fread(&accounts, sizeof(accounts), i, fp);
i++;
}
}