Hi All,
First Wish you a happy new year.
Please conform me, my understanding is correct on below program.
#include <stdio.h>
main()
{
int *p;
printf("%d", ((int )(p+1) - (int )p));
}
If I remove cast operation (int ). compiler explicitly will give the difference between the int * pointer. ie. 1.
If I use cast operator, compiler will update the difference of two integer..ie 4.
Thanks in advance.
First Wish you a happy new year.
Please conform me, my understanding is correct on below program.
#include <stdio.h>
main()
{
int *p;
printf("%d", ((int )(p+1) - (int )p));
}
If I remove cast operation (int ). compiler explicitly will give the difference between the int * pointer. ie. 1.
If I use cast operator, compiler will update the difference of two integer..ie 4.
Thanks in advance.
Comment