what the function f2 doing in the below program ?

0 votes
asked Sep 3 by function
explain about the function(void f2()) doing

void f1(int *p);
void f2(int b[]);
main()
{
int a[5]={10,20,30,40,50};
f1(a);
f2(a);
getch();

}
void f1(int *p)
{
++p;
printf("%d",*(p+1));
}
void f2(int b[])
{
b++;
printf("%d",b[1]);
}

1 Answer

0 votes
answered Sep 3 by anonymous
It seems to be printing the next element in the array.

Element 1 is 20 so b++ would move to element 2 which is 30.

Prints 3030
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...