Ok...its been two days now and I can't get it yet! I googled for long hours but couldn't find what exactly I was looking for. So, here it is -
Say, I have a structure with only one element. (I'll add more elements to the structure once I get it to work!)
Now when the program is run, I want the user to specify the number of students and then allocate the necessary memory using malloc(). So, I did this -
Now, I am having difficulties in stroing the values and then displaying those values back to the screen. I used the following code -
pt= (REC *) malloc (num*sizeof(REC)); // I also tried this without casting!
when I try do compile it, I get the error "invalid type argument of `unary *'".
printf("\n* * * * Enter roll no of students. * * * *\n");
printf("\n* * * * Entered roll no. * * * *\n");
printf("%d, ",*(pt+i)->roll); //This is where the error occures!
How can I solve this?
P.S. I am using wxdev C++.