main(){

char a[100];

a[0]='a';a[1]]='b';a[2]='c';a[4]='d';

abc(a);

}

abc(char a[]){

a++;

printf("%c",*a);

a++;

printf("%c",*a);

}

Answers were Sorted based on User's Feedback



main(){ char a[100]; a[0]='a';a[1]]='b';a[2]='c';a..

Answer / susie

Explanation:

The base address is modified only in function and as a
result a points to 'b' then after incrementing to 'c' so bc
will be printed.

Is This Answer Correct ?    1 Yes 1 No

main(){ char a[100]; a[0]='a';a[1]]='b';a[2]='c';a..

Answer / romeyo

bc

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Code Interview Questions

Is the following code legal? typedef struct a { int x; aType *b; }aType

1 Answers  


main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024

2 Answers   HCL,


main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } a. Runtime error. b. 0, 0 c. Compile error d. the first two values entered by the user

2 Answers   HCL,


Implement a t9 mobile dictionary. (Give code with explanation )

1 Answers   Amazon, Peak6, Yahoo,


Code for 1>"ascii to string" 2>"string to ascii"

1 Answers   Aricent, Global Logic,






main() { int c=- -2; printf("c=%d",c); }

1 Answers   TCS,


How to swap two variables, without using third variable ?

104 Answers   AB, ADP, BirlaSoft, Cisco, Cygnet Infotech, HCL, Hewitt, Honeywell, HP, IBM, Infosys, Manhattan, Microsoft, Mobius, Percept, Satyam, SofTMware, TCS, Wipro, Yamaha,


respected sir, i did my MCA in 2013 when i am going to attend to an interview i was asked about my project how will i explain my project could please help me in this and my project title is "Social Networking Site For Social Responsibility"

1 Answers   Genpact, Ozdocs,


Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.

2 Answers   Wipro,


void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }

3 Answers  


#include<stdio.h> void fun(int); int main() { int a; a=3; fun(a); printf("\n"); return 0; } void fun(int i) { if(n>0) { fun(--n); printf("%d",n); fun(--n); } } the answer is 0 1 2 0..someone explain how the code is executed..?

1 Answers   Wipro,


In the following pgm add a stmt in the function fun such that the address of 'a' gets stored in 'j'. main(){ int * j; void fun(int **); fun(&j); } void fun(int **k) { int a =0; /* add a stmt here*/ }

1 Answers  


Categories