:Structsへのポインタのメンバにアクセスするにはどうすればよいですか?私が持っている私のヘッダーで
#define MAXSTRSIZE 20
struct Account{
char* Name;
char* Password;
};
と私は私の主な機能は:何かないのメンバーのリクエスト 『名前』:
struct Account* const AccountList=malloc(sizeof(struct Account)*AccountAmount)//AccountAmount is just an int value input by the user
FILE* File = fopen(FileName,"r");
int Counter;//Counter for the For Loop
for (Counter=0;Counter<AccountAmount;Counter++)
{
*(AccountList+Counter).Name=malloc(sizeof(char)*MAXSTRSIZE);
*(AccountList+Counter).Password=malloc(sizeof(char)*MAXSTRSIZE);
fscanf(File,"%s%s",*(AccountList+Counter).Name,*(AccountList+Counter).Password);
私は、私は次のようなエラー」のエラーを取得するコンパイル構造体または共用体 "と呼びます。どのように私は実際にメンバーを含む構造体で私の割り当てられた領域を埋めるのですか?
また、(*(AccountList + Counter))を書くこともできますが、AccountList [Counter] .Nameを可読性のために使用します... – Byte