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

What will be result of the following program?
void myalloc(char *x, int n)
{
x= (char *)malloc(n*sizeof(char));
memset(x,\0,n*sizeof(char));
}
main()
{
char *g="String";
myalloc(g,20);
strcpy(g,"Oldstring");
printf("The string is %s",g);
}
a) The string is : String
b) Run time error/Core dump
c) The string is : Oldstring
d) Syntax error during compilation
e) None of these

Answer Posted / vijoeyz

Run time error/Core dump.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does %d do in c?

921


Can we declare a function inside a function in c?

1002


write a program to copy the string using switch case?

2865


How many identifiers are there in c?

981


You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.

2297


What are the different types of pointers used in c language?

1010


In c programming language, how many parameters can be passed to a function ?

1072


Is that possible to add pointers to each other?

1336


Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

2311


What is the difference between local variable and global variable in c?

1176


What is function definition in c?

1036


What is volatile keyword in c?

1009


What is the difference between fread and fwrite function?

1054


What is a function simple definition?

1049


Explain how can you determine the size of an allocated portion of memory?

1060