Write a single line c expression to delete a,b,c from aabbcc

Answers were Sorted based on User's Feedback



Write a single line c expression to delete a,b,c from aabbcc..

Answer / shirley

in arrays:

char a[6]="aabbcc";
for(i=0;i<3;i+=2)
a[i]=a[i+2];
a[i+1]='\0';

using pointers:

*s="aabbcc"
for(i=0;i<3;i++)
*(s+i)=*(s+i+2);
*(s+i+1)='\0';

Is This Answer Correct ?    10 Yes 7 No

Write a single line c expression to delete a,b,c from aabbcc..

Answer / arihant jain

printf("%s\b\b\b\b\b\b \b\b\b\b\b\babc","aabbcc");

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More C Code Interview Questions

main() { int i; i = abc(); printf("%d",i); } abc() { _AX = 1000; }

2 Answers  


How we print the table of 3 using for loop in c programing?

7 Answers  


#define FALSE -1 #define TRUE 1 #define NULL 0 main() { if(NULL) puts("NULL"); else if(FALSE) puts("TRUE"); else puts("FALSE"); }

1 Answers  


hello sir,is there any function in C that can calculate number of digits in an int type variable,suppose:int a=123; 3 digits in a.what ll b answer?

6 Answers  


Write a routine that prints out a 2-D array in spiral order

3 Answers   Microsoft,


posted by surbhi just now main() { float a = 5.375; char *p; int i; p=(char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char) p[i]); } how is the output of this program is :: 0000ac40 please let me know y this output has come

2 Answers   GATE,


struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }

1 Answers  


write a program to count the number the same (letter/character foreg: 's') in a given sentence.

2 Answers  


main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

1 Answers   CSC,


All the combinations of prime numbers whose sum gives 32

1 Answers   HHH,


what is brs test reply me email me kashifabbas514@gmail.com

0 Answers  


What is "far" and "near" pointers in "c"...?

3 Answers  


Categories