Its a part of code that i working on. When i try to assign Diagcb.end
to ptr2
it returned an error.
I tried to write it as:
ptr2 = &Diagcb.end;
ptr2 = &diagcb->end;
but the same error is returned.
typedef struct reportType {
int a;
int b;
int c;
int* ptr;
} reportType;
typedef struct cb {
reportType* start;
reportType* end;
reportType arr[10];
}cb;
int fun (reportType* report);
main()
{
cb Diagcb;
reportType report;
report.a = 0;
report.b = 1;
report.c = 2;
report.ptr = NULL;
reportType* ptr2;
ptr2 = cb.end;
}
You should write it as ptr2 = Diagcb.end
. Because Diagcd.end
is already a pointer, you don't need to use &
to get the address.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.