Why is GCC giving me this error ? What am I doing wrong here ?
temp.c: In function main:
temp.c:6: error: invalid operands to binary +
Code:
main()
{
char *Address1,*Address2,*NewAddress;
Address1= (char*)0x12;
Address2= (char*)0x34;
NewAddress = Address1+Address2;
}
Why do you want to do that?
The C language forbids addition of two pointers. It only defines (with severe restrictions) the addition of a pointer and an integer.
Basically, you can only add to a pointer an integer small enough so that the result was inside, or at the ending border, of some allocated memory zone.