Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct one {
- char a;
- char b;
- };
- struct two {
- struct one c;
- struct one d;
- };
- void firstfunction(void *source, void *dest, int size)
- {
- memcpy(dest,source,size)
- }
- void secondfunction(struct two *onedata)
- {
- struct two twodata;
- firstfunction((void *)onedata->c,(void *)&twodata.c,2);
- }
- void main()
- {
- struct two onedata;
- secondfunction(&onedata);
- }
- gcc -g -O2 struct.c -o struct
- struct.c: In function ‘secondfunction’:
- struct.c:19:2: error: cannot convert to a pointer type
- firstfunction((void *)onedata->c,(void *)&twodata.c,2);
- ^~~~~~~~~~~~~
- <builtin>: recipe for target 'struct' failed
- make: *** [struct] Error 1
Add Comment
Please, Sign In to add comment