I can't get the code below to compile (see errors). Advice on correction would be appreciated.
#include <stdio.h>
typedef struct {
char *fldName;
unsigned fldLen;
} Field;
typedef struct {
char *fldPrompt;
unsigned startRow;
unsigned startCol;
} Prompt;
typedef struct {
Field *fields[];
Prompt *prompts[];
unsigned numFlds; <<< invalid field declaration after empty field
} Form; <<< in '(incomplete) struct (no name)'.
Field firstName = { "fName", 12 };
Field surName = { "sName", 25 };
Field gender = { "gder", 1 };
Prompt fn = { "First Name : ", 4, 10 };
Prompt sn = { "Surname : ", 6, 10 };
Prompt gn = { "Gender : ", 8, 10 };
int main (void)
{
Form aForm = { { &firstName, &surName, &gender },
{ &fn, &sn, &gn},
3 }; <<< Multiple initializers for the same element
return 0; <<< Too many initializers
}