Couple questions along these lines, but I dont quite understand any of them.
struct bundle
{
int x;
int y;
};
void foo(struct bundle *A, int p)
{
A->x = p;
A->y = p;
}
main()
{
struct bundle ptr;
foo(&ptr, 0);
//printf("%d",*(ptr + 1)); ISSUE HERE
}
My print statement is not working... Any ideas?
I'm using an online C compiler which is giving me this error
invalid operands to binary +
but I dont think that the compiler has anything to do with it.
I've tried casting it to an (int *)
but no luck. I am pretty sure I am doing the correct *(ptr + 1)
and I dont have to do *(ptr + sizeof(int))
or anything like that.
Thanks for the help!