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



main() { char *a = "Hello "; char *b = "World"; cl..

Answer / guest

d) World, copies World on a, overwrites Hello in a.

Is This Answer Correct ?    13 Yes 1 No

main() { char *a = "Hello "; char *b = "World"; cl..

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

main() { char *a = "Hello "; char *b = "World"; cl..

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

main() { char *a = "Hello "; char *b = "World"; cl..

Answer / vijeselvam

answer is (d)

The correct answer will be "HelloHello"

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Code Interview Questions

I need your help, i need a Turbo C code for this problem.. hope u'll help me guys.? Your program will have a 3x3 array. The user will input the sum of each row and each column. Then the user will input 3 values and store them anywhere, or any location or index, temporarily in the array. Your program will supply the remaining six (6) values and determine the exact location of each value in the array. Example: Input: Sum of row 1: 6 Sum of row 2: 15 Sum of row 3: 24 Sum of column 1: 12 Sum of column 2: 15 Sum of column 3: 18 Value 1: 3 Value 2: 5 Value 3: 6 Output: Sum of Row 1 2 3 6 4 5 6 15 7 8 9 24 Sum of Column 12 15 18 Note: Your program will not necessary sort the walues in the array Thanks..

0 Answers  


Who could write how to find a prime number in dynamic array?

1 Answers  


create a login program that ask username and password. if you input username or password 3 times wrong, the program will terminate else the program will prompt a message "congratulations"

2 Answers  


#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }

1 Answers  


main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }

2 Answers   Wipro,






main() { int i=-1; +i; printf("i = %d, +i = %d \n",i,+i); }

1 Answers  


why java is platform independent?

13 Answers   Wipro,


What is the hidden bug with the following statement? assert(val++ != 0);

1 Answers  


/*what is the output for*/ void main() { int r; printf("Naveen"); r=printf(); getch(); }

4 Answers  


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() { int (*functable[2])(char *format, ...) ={printf, scanf}; int i = 100; (*functable[0])("%d", i); (*functable[1])("%d", i); (*functable[1])("%d", i); (*functable[0])("%d", &i); } a. 100, Runtime error. b. 100, Random number, Random number, Random number. c. Compile error d. 100, Random number

1 Answers   HCL, rsystems,


write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details

2 Answers   TCS,


Categories