main()
{
int c[]={2,8,3,4,4,6,7,5};
int j,*p=c,*q=c;
for(j=0;j%26lt;5;j++)
{
printf("%d",*c);
++q;
}
for(j=0;j%26lt;5;j++)
{
printf("%d",*p);
++p;
}
}
What is the output of the following C program?
c is a pointer to the 1st element in the array.
p and q are also pointers to the 1st element in the array.
the first loop prints *c which would be 2 (does this 5 times because it never changes the pointer c.
the second loop prints *p then increments p to the next element in the array (5 times)
full output would be:
2222228344 (5 2s from the c pointer, 28344 from the p pointer)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment