I am trying to write a C program. I need the address of variable "recq". Can someone pls help me figure that out?
typedef struct {
int recq;
} dd;
struct test {
dd a;
};
main(){
struct test *mm;
mm=(struct test *) malloc (sizeof (struct test));
ss=&(mm->a.recq);
printf("%p",ss);
}
What you have looks good except you need to declare the ss variable:
First of all, you need to declare
ss
as "int * " , or use cast whatever the rest of your code is right, I think.Your required program is,