Write a single line c expression to delete a,b,c from aabbcc
Answers were Sorted based on User's Feedback
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 |
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 |
main() { 41printf("%p",main); }8
void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(“%d”,k); }
main() { struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }
main() { int i=-1; +i; printf("i = %d, +i = %d \n",i,+i); }
main() { int x=5; clrscr(); for(;x==0;x--) { printf("x=%d\n”", x--); } } a. 4, 3, 2, 1, 0 b. 1, 2, 3, 4, 5 c. 0, 1, 2, 3, 4 d. none of the above
#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }
main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); }
main() { char *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }
main() { static int var = 5; printf("%d ",var--); if(var) main(); }
Finding a number multiplication of 8 with out using arithmetic operator
main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }
main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?