U
udayan.singh
Hi ,
tried this prog .. need a clarification..
--------------------------------------------------------------------------
[root@localhost chap02]# cat a3.c
#include <stdio.h>
void print(int *a, int *b, int *c, int *d , int *e)
{
printf("\n %d %d %d %d %d \n", *a,*b, *c, *d , *e);
}
int main()
{
static int arr[] = {97, 98, 99, 100, 101, 102, 103, 104};
int *ptr = arr + 1;
print(++ptr, ptr--, ptr, ptr++ , ++ptr);
return 0;
}
--------------------------------------------------------------------------
i expected the output to be (reason being that the computation takes
place from right extreme of the function - i think like that, might b i
m wrong)
100 100 100 99 99
--------------------------------------------------------------------------
but the actual output is :
100 100 100 99 100
--------------------------------------------------------------------------
pls explain!!!!!
tia,
Udayan
tried this prog .. need a clarification..
--------------------------------------------------------------------------
[root@localhost chap02]# cat a3.c
#include <stdio.h>
void print(int *a, int *b, int *c, int *d , int *e)
{
printf("\n %d %d %d %d %d \n", *a,*b, *c, *d , *e);
}
int main()
{
static int arr[] = {97, 98, 99, 100, 101, 102, 103, 104};
int *ptr = arr + 1;
print(++ptr, ptr--, ptr, ptr++ , ++ptr);
return 0;
}
--------------------------------------------------------------------------
i expected the output to be (reason being that the computation takes
place from right extreme of the function - i think like that, might b i
m wrong)
100 100 100 99 99
--------------------------------------------------------------------------
but the actual output is :
100 100 100 99 100
--------------------------------------------------------------------------
pls explain!!!!!
tia,
Udayan