this is my program..............
struct name
{
int a;
char b[10];
char c;
};
int main()
{
struct name *p;
char *n;
n = (char *)malloc(3 * sizeof(char));
n = (char *)p;
What i want to do is i want to access structure through character pointer n......like
" n->a=3; "
what the problem in above line is its not working.showing error.
" error: request for member ‘a’ in something not a structure or union"...........
i dont know why............iam having doubt whether we can assign
" n = (char *)p; "
this line ...............if its correct can any one finish this program......................
struct name
{
int a;
char b[10];
char c;
};
int main()
{
struct name *p;
char *n;
n = (char *)malloc(3 * sizeof(char));
n = (char *)p;
What i want to do is i want to access structure through character pointer n......like
" n->a=3; "
what the problem in above line is its not working.showing error.
" error: request for member ‘a’ in something not a structure or union"...........
i dont know why............iam having doubt whether we can assign
" n = (char *)p; "
this line ...............if its correct can any one finish this program......................