What will be the output of following programs and why ?
1)
void foo(float *);
int main()
{
int i = 10, *p = &i;
foo((float*)&i);
return 0;
}
void foo(float *p)
{
printf("%f\n", *p);
}
2)
int main()
{
char arr[] = "geeksforgeeks";
char *ptr = arr;
while(*ptr != '\0')
++*ptr++;
printf("%s %s", arr, ptr);
getchar();
return 0;
}
3)
int main()
{
int c=5;
printf("%d\n%d\n%d", c, c <<= 2, c >>= 2);
getchar();
}
Output:4 4 4
I am not getting why the 3rd one is 4,because 5>>2 will give 1