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; }

}



main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { ..

Answer / susie

Answer :

2 2 2 2 2 2 3 4 6 5

Explanation:

Initially pointer c is assigned to both p and q.
In the first loop, since only q is incremented and not c ,
the value 2 will be printed 5 times. In second loop p itself
is incremented. So the values 2 3 4 6 5 will be printed.

Is This Answer Correct ?    46 Yes 9 No

Post New Answer

More C Code Interview Questions

Write a C program to print look and say sequence? For example if u get the input as 1 then the sequence is 11 21 1211 111221 312211 12112221 .......(it counts the no. of 1s,2s etc which is in successive order) and this sequence is used in run-length encoding.

1 Answers  


main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); } int i;

1 Answers  


Is this code legal? int *ptr; ptr = (int *) 0x400;

1 Answers  


main() { char a[4]="HELL"; printf("%s",a); }

3 Answers   Wipro,


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

0 Answers   Honeywell,






code of a program in c language that ask a number and print its decremented and incremented number.. sample output: input number : 3 321123

1 Answers   HCL,


void pascal f(int i,int j,int k) { printf(ā€œ%d %d %dā€,i, j, k); } void cdecl f(int i,int j,int k) { printf(ā€œ%d %d %dā€,i, j, k); } main() { int i=10; f(i++,i++,i++); printf(" %d\n",i); i=10; f(i++,i++,i++); printf(" %d",i); }

1 Answers  


What are the following notations of defining functions known as? i. int abc(int a,float b) { /* some code */ } ii. int abc(a,b) int a; float b; { /* some code*/ }

1 Answers  


why is printf("%d %d %d",i++,--i,i--);

4 Answers   Apple, Cynity, TCS,


void main() { static int i=5; if(--i){ main(); printf("%d ",i); } }

1 Answers  


#include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?

2 Answers  


program to find magic aquare using array

4 Answers   HCL,


Categories