what is the output of the following program?
main()
{
int c[]={2,8,3,4,4,6,7,5};
int j,*p=c,*q=c;
for(j=0;j<5;j++)
{
printf("%d",*c);
++q;
}
for(j=0;j<5;j++)
{
printf("%d",*p);
++p;
}
}

Answers were Sorted based on User's Feedback



what is the output of the following program? main() { int c[]={2,8,3,4,4,6,7,5}; int j,*p=c,*q..

Answer / praveen

2222228344

Is This Answer Correct ?    8 Yes 0 No

what is the output of the following program? main() { int c[]={2,8,3,4,4,6,7,5}; int j,*p=c,*q..

Answer / vignesh1988i

2222228344...

the above code can be remodified as :
printf("%d",*q); in first printf statement to get the same
output for both printf statements



thank u

Is This Answer Correct ?    2 Yes 0 No

what is the output of the following program? main() { int c[]={2,8,3,4,4,6,7,5}; int j,*p=c,*q..

Answer / ashwin kumar

output is 2222228344


in loop 1

as we know that array variable contain the base address of
the array

*c means we are trying to print the value of contained in
the base address which is not changed in the loop

note we can't change the base address of the array that is
we can't do 'c++'

as in loop for 5 times contain of the base address will be
printed as
22222



in loop 2

in assigned base address of the array to pointer p

here we are printing the contain of address stored in p and
increment the value of p ( that is pointing to the next
element of the array )

so we will get output for 2nd loop is

28344


overall answer is

2222228344

if any wroung in my aswer plz info me at

molugu.ashwin@gamil.com

Is This Answer Correct ?    2 Yes 0 No

what is the output of the following program? main() { int c[]={2,8,3,4,4,6,7,5}; int j,*p=c,*q..

Answer / abhradeep chatterjee

2222228344 will be the answer. I think everybody answered
before me is correct.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Interview Questions

Where define directive used?

0 Answers  


Write a C program that computes the value ex by using the formula ex =1+x/1!+x2/2!+x3+3!+………….

1 Answers  


What is Memory leakage ?

2 Answers   HCL,


i have a written test in tomorrow

1 Answers   NNN, Value Labs,


define c

6 Answers   HCL, TCS,






How can I access a memory located at certain address?

2 Answers   CSC,


wat is the output #define VOLEDEMORT _who_must_not_be_named int main() { printf("VOLEDEMORT"); }

2 Answers  


fn f(x) { if(x<=0) return; else f(x-1)+x; }

5 Answers   HCL,


What does c mean in basketball?

0 Answers  


I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...

0 Answers  


Why is c fast?

0 Answers  


what are two categories of clint-server application development ?

1 Answers  


Categories