Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



main() { char *p = "hello world"; p[0] = 'H'; ..

Answer / ajay karanam

a. Runtime error.

Is This Answer Correct ?    22 Yes 9 No

main() { char *p = "hello world"; p[0] = 'H'; ..

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

main() { char *p = "hello world"; p[0] = 'H'; ..

Answer / guest

b) Hello world

Is This Answer Correct ?    21 Yes 16 No

main() { char *p = "hello world"; p[0] = 'H'; ..

Answer / sandeep

answer:

Hello word

Is This Answer Correct ?    4 Yes 6 No

main() { char *p = "hello world"; p[0] = 'H'; ..

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

Post New Answer

More C Code Interview Questions

Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)

7 Answers   Microsoft,


#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }

1 Answers  


main() { int i = 258; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

1 Answers  


How do you write a program which produces its own source code as its output?

7 Answers  


main() { char *cptr,c; void *vptr,v; c=10; v=0; cptr=&c; vptr=&v; printf("%c%v",c,v); }

1 Answers  


#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); }

3 Answers   Hexaware,


main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

3 Answers   GNITC,


Write a program using one dimensional array to assign values and then display it on the screen. Use the formula a[i]=i*10 to assign value to an element.

1 Answers   Samar State University,


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,


why java is platform independent?

13 Answers   Wipro,


write a c program to Reverse a given string using string function and also without string function

1 Answers  


Cau u say the output....?

1 Answers  


Categories