main()
{
printf("\nab");
printf("\bsi");
printf("\rha");
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
hai
Explanation:
\n - newline
\b - backspace
\r - linefeed
Is This Answer Correct ? | 92 Yes | 13 No |
Answer / jane
<new line>ab<backspace>si<carriage return>ha
First, handle the backspace. Note that even though it is "non-erase", the next character to be output would overwrite what was backspaced over:
<new line>asi<carriage return>ha
Now, a carriage return means to go back to the beginning of the line. So the "ha" overwrites the "as" in "asi:
<new line>hai
Now, the cursor is currently sitting on the i, so the next character to be output would overwrite i.
Is This Answer Correct ? | 34 Yes | 2 No |
main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }
main() { char not; not=!2; printf("%d",not); }
char *someFun1() { char temp[ ] = “string"; return temp; } char *someFun2() { char temp[ ] = {‘s’, ‘t’,’r’,’i’,’n’,’g’}; return temp; } int main() { puts(someFun1()); puts(someFun2()); }
void main() { int *i = 0x400; // i points to the address 400 *i = 0; // set the value of memory location pointed by i; }
why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?
What is the output for the program given below typedef enum errorType{warning, error, exception,}error; main() { error g1; g1=1; printf("%d",g1); }
int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }
main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above
main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }
¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-30 but in same question if we write as- ¦void main() ¦{ ¦int i=10; ¦ int j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-33 why output is changed from 30 to 33. Can any body answer...
Design an implement of the inputs functions for event mode
char *someFun() { char *temp = “string constant"; return temp; } int main() { puts(someFun()); }