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 |
Write out a function that prints out all the permutations of a string. For example, abc would give you abc, acb, bac, bca, cab, cba. You can assume that all the characters will be unique.
5 Answers IITR, Microsoft, Nike,
void main() { static int i=i++, j=j++, k=k++; printf(“i = %d j = %d k = %d”, i, j, k); }
main() { int a[10]; printf("%d",*a+1-*a+3); }
source code for delete data in array for c
# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }
Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines
#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }
4 Answers Google, HCL, Quick Heal, WTF,
main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } a. Runtime error. b. 0, 0 c. Compile error d. the first two values entered by the user
main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }
void main() { int c; c=printf("Hello world"); printf("\n%d",c); }
struct Foo { char *pName; char *pAddress; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); obj->pName = malloc(100); obj->pAddress = malloc(100); strcpy(obj->pName,"Your Name"); strcpy(obj->pAddress, "Your Address"); free(obj); printf("%s", obj->pName); printf("%s", obj->pAddress); } a. Your Name, Your Address b. Your Address, Your Address c. Your Name Your Name d. None of the above
what is the code of the output of print the 10 fibonacci number series