main()
{
char *p = "hello world";
p[0] = 'H';
printf("%s", p);
}
a. Runtime error.
b. “Hello world”
c. Compile error
d. “hello world”
Answers were Sorted based on User's Feedback
Answer / deepesh sharma
The Answer is
a) Runtime Error.
Details: hello world is a constant string and the address of
the memory location where this string is stored is assigned
to p. In second line you are changing the value at that
address which is constant string hence changing a constant
is runtime error.
Is This Answer Correct ? | 18 Yes | 7 No |
Answer / vijayanand yadav ("appu s
compile time error,
because of the semi colon present in the variable char *p="hello world";p[0]='H';here in this example the semi colon is just replaced with a , operator....
Is This Answer Correct ? | 0 Yes | 8 No |
How can I Create a C program in splitting set of characters to specific subsets. Example: INPUT SET OF CHARACTERS: Therefore, my dear brothers and sisters, stand firm. Let nothing move you. Always give yourselves fully to the work of the Lord, because you know that your labor in the Lord is not in vain. SPLIT INTO HOW MANY CHARACTERS PER SUBSETS: 10 OUTPUT: Therefore, my dear b rothers an d sisters, stand fir m. Let not hing move you. Alway s give you rselves fu lly to the work of t he Lord, b ecause you know that your labo r in the L ord is not in vain.
How can i find first 5 natural Numbers without using any loop in c language????????
void ( * abc( int, void ( *def) () ) ) ();
Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list)
3 Answers Disney, Google, ZS Associates,
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
Finding a number multiplication of 8 with out using arithmetic operator
Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.
2 Answers Mentor Graphics, Microsoft,
Write a program to implement the motion of a bouncing ball using a downward gravitational force and a ground-plane friction force. Initially the ball is to be projected in to space with a given velocity vector
main() { int i=5; printf(“%d”,i=++i ==6); }
Is the following code legal? struct a { int x; struct a b; }
x=2 y=3 z=2 x++ + y++; printf("%d%d" x,y);
How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.