Hello.
The following is my structure which are used to get the user input:
struct STATE
{ char *st[]
int quantity
}
How can I pass the above structure to Function?
And How can I access it in function? Using Pointer?
Thank You
Jacob
Printable View
Hello.
The following is my structure which are used to get the user input:
struct STATE
{ char *st[]
int quantity
}
How can I pass the above structure to Function?
And How can I access it in function? Using Pointer?
Thank You
Jacob
Code:
struct STATE
{ char *st[];
int quantity;
}
*STATEptr;
STATEptr = malloc(sizeof(STATE);
..........
// call a function
myfunc(STATEptr);
// define the function
void myfunc(struct STATE *p){
printf("%d\n",p->quantity);
}