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 the result of the following program ?
char *gxxx()
{
static char xxx[1024];
return xxx;
}

main()
{
char *g="string";
strcpy(gxxx(),g);
g = gxxx();
strcpy(g,"oldstring");
printf("The string is :
%s",gxxx());
}
a) The string is : string
b) The string is :Oldstring
c) Run time error/Core dump
d) Syntax error during compilation
e) None of these

Answers were Sorted based on User's Feedback



what will be the result of the following program ? char *gxxx() ..

Answer / jaya prakash

b) The String is :OldString

Because ,for Static var memory is only one time created.
Eventhough the fn is multiple times called,
so
consider addr of xxx is 4444,
first strcpy copy the string "string" to addr 4444,
then g=4444;
then oldstring overwrites to location 4444.

Is This Answer Correct ?    8 Yes 0 No

what will be the result of the following program ? char *gxxx() ..

Answer / abhiraj

oldstring

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More C Interview Questions

What is volatile variable in c with example?

0 Answers  


What functions are used for dynamic memory allocation in c language?

0 Answers  


hi send me sample aptitude papers of cts?

0 Answers  


main() { int i; printf("%d",i^i); }

1 Answers  


why Language C is plateform dependent

3 Answers   Siemens, Wipro,


How can I read a directory in a c program?

1 Answers   CSC,


What is time complexity c?

0 Answers  


Write a c program to build a heap method using Pointer to function and pointer to structure ?

0 Answers   MAHINDRA, Protech, Sivan Tech,


do u print this format '(((())))'. This brackets is based on user input like 4 or 5 or 6,without using any loop's?

1 Answers   Oracle,


a number is perfect if it is equal to the sum of its proper divisor.. 6 is perfect number coz its proper divisors are 1,2 and three.. and 1+2+3=6... a number is deficient if the sum of its proper divisor is less than the number.. sample: 8 is deficient, coz its proper divisors are 1,2 and 4, and 1+2+4=7. abundant number, if the sum of its proper divisor is greater than the number.. sample..12 is abundant coz 1+2+3+4+6=16 which is geater than 12. now write a program that prompts the user for a number, then determines whether the number is perfect,deficient and abundant..

1 Answers  


Write a programm such that if user enter 11.25 it roundup to 11 but if user enter 11.51 upto 11.99 it will round up to 12 i.e.;convert the floting point value into integer format as explain above..

2 Answers  


What is "Hungarian Notation"?

0 Answers   Celstream,


Categories