main()
{
char *a = "Hello ";
char *b = "World";
clrscr();
printf("%s", strcpy(a,b));
}
a. “Hello”
b. “Hello World”
c. “HelloWorld”
d. None of the above
Answers were Sorted based on User's Feedback
Answer / guest
d) World, copies World on a, overwrites Hello in a.
| Is This Answer Correct ? | 13 Yes | 1 No |
Answer / sandeep tayal
This would produce an error message if you are using g++
compiler in UNIX as g++ does not allow constant strings to
be a part of the char *;
If this is run in Turbo C then it will produce the output
shown in above
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / sanjay bhosale
This produces runtime exception as we are attempting to read or write protected memory in Visual c++.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / vijeselvam
answer is (d)
The correct answer will be "HelloHello"
| Is This Answer Correct ? | 0 Yes | 0 No |
union u { struct st { int i : 4; int j : 4; int k : 4; int l; }st; int i; }u; main() { u.i = 100; printf("%d, %d, %d",u.i, u.st.i, u.st.l); } a. 4, 4, 0 b. 0, 0, 0 c. 100, 4, 0 d. 40, 4, 0
main() { main(); }
Write a C program to print look and say sequence? For example if u get the input as 1 then the sequence is 11 21 1211 111221 312211 12112221 .......(it counts the no. of 1s,2s etc which is in successive order) and this sequence is used in run-length encoding.
void main() { int c; c=printf("Hello world"); printf("\n%d",c); }
#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }
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,
#include<stdio.h> main() { int i=1,j=2; switch(i) { case 1: printf("GOOD"); break; case j: printf("BAD"); break; } }
programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h
void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); }
PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
struct Foo { char *pName; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); strcpy(obj->pName,"Your Name"); printf("%s", obj->pName); } a. Your Name b. compile error c. Name d. Runtime error
main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }