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

create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00

0 Answers   Microsoft,


main() { extern i; printf("%d\n",i); { int i=20; printf("%d\n",i); } }

1 Answers  


func(a,b) int a,b; { return( a= (a==b) ); } main() { int process(),func(); printf("The value of process is %d !\n ",process(func,3,6)); } process(pf,val1,val2) int (*pf) (); int val1,val2; { return((*pf) (val1,val2)); }

1 Answers   Satyam,


main ( ) { static char *s[ ] = {“black”, “white”, “yellow”, “violet”}; char **ptr[ ] = {s+3, s+2, s+1, s}, ***p; p = ptr; **++p; printf(“%s”,*--*++p + 3); }

1 Answers  


main() { int x=5; for(;x!=0;x--) { printf("x=%d\n", x--); } } a. 5, 4, 3, 2,1 b. 4, 3, 2, 1, 0 c. 5, 3, 1 d. none of the above

2 Answers   HCL,






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

3 Answers   CSC,


main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above

1 Answers   HCL,


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates.

19 Answers   Amazon, BITS, Microsoft, Syncfusion, Synergy, Vector,


how to return a multiple value from a function?

5 Answers   Wipro,


How do you sort a Linked List (singly connected) in O(n) please mail to pawan.10k@gmail.com if u can find an anser...i m desperate to knw...

6 Answers   Microsoft, MSD, Oracle,


why the range of an unsigned integer is double almost than the signed integer.

1 Answers  


void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }

2 Answers  


Categories