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...

f(char *p)
{
p=(char *)malloc(sizeof(6));
strcpy(p,"HELLO");
}
main()
{
char *p="BYE";
f(p)
printf("%s",p);
}
what is the output?

Answer Posted / anu

the output wll be hello , since the argument is overwritten
with new memory in the function.

so in main, when it comes to printf, p points to the
allocatd memory, which contains hello

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above

1042


What is the difference between pure virtual function and virtual function?

1088


How do we print only part of a string in c?

986


Write a program to implement queue.

1083


What is equivalent to ++i+++j?

1055


pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

2605


What is a static variable in c?

1083


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

2256


What is file in c preprocessor?

1101


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

1216


Why use int main instead of void main?

1080


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

2022


Explain can the sizeof operator be used to tell the size of an array passed to a function?

1029


What do you mean by a local block?

1048


What are the types of type specifiers?

992