I have this struct:
#define sbuffer 128
#define xbuffer 1024
typedef struct{
char name[sbuffer];
char att[sbuffer];
char type[sbuffer];
int noOfVal;
int ints[xbuffer];
double doubles[xbuffer];
char *strings[xbuffer];
} variable;
I need to create an array from this struct, I did this
variable *vars[512]; //is it right
If I want to put a string that I had in s into the name, I did this:
char *s = "What Ever";
strcpy(vars[0]->name,s);
but this doesn’t work for me, can anyone help?
Get rid of the
*in this line:And use dot syntax to access the struct member in
strcpy: