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()
{
int *ptr=(int*)malloc(sizeof(int));
*ptr=4;
printf("%d",(*ptr)+++*ptr++);
}

Answers were Sorted based on User's Feedback



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

Answer / s k dubey

hello ,if problem is..
int *p=(int*)malloc(sizeof(int));
*p=4;
printf("%d",(*p)+++(*p)++);

o/p is 9;

it is just similar the case of post incremental operation of
variable like i+++i++.

Is This Answer Correct ?    158 Yes 14 No

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

Answer / vishnu

hi all,
i think *ptr=(int*)malloc(size of (int));
*ptr=4;
mean malloc(size of (int)) is used to allocate memory of only 4.
hence(*ptr)+++*ptr++)=4+4=8

Is This Answer Correct ?    28 Yes 43 No

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

Answer / ankit panwar

*ptr++ : it just increments the pointer not the value it is
pointing to..

++*ptr : it increments the value the pointer points to but
not the pointer..

here

(*ptr++) + (++*ptr) = 0 + (4+1) = 5

so the answer will definately be 5

Is This Answer Correct ?    2 Yes 31 No

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

Answer / aravind

I think it gives syntax error because there is no operation in C which says P+++ just P++.If he can seperate that one + than the above ans is will be 5+5=10.

Is This Answer Correct ?    5 Yes 35 No

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

Answer / manil shrama

hello all..........
here malloc function reserves a memory space for an integer,whose adddess is pointed by integer pointer p.
Now at this memory space,4 istored by using *p = 4

(*p)+++means,*p=*p+2, (4+2=6)
and ptr++ means,*ptr=*ptr+1, (4+1=5)


now 4*5=30 is required answer
k bye.....tc

Is This Answer Correct ?    6 Yes 49 No

Post New Answer

More C Interview Questions

what is the difference between c and c++?

7 Answers  


Is c functional or procedural?

1 Answers  


how can i print "hello"

3 Answers  


write a program to insert an element at the specified position in the given array in c language

5 Answers   Appin, IBM,


What is chain pointer in c?

0 Answers  


the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

0 Answers  


diff between exptected result and requirement?

0 Answers   HCL,


a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above

0 Answers  


When should volatile modifier be used?

0 Answers  


Determine the result of performing two successive block transfers into the same area of a frame buffer using the binary arith operations

0 Answers  


wht is the difference between KPO and BPO ?

2 Answers   Accenture, BPO, HCK, HCL, Infosys,


12344321 123 321 12 21 1 1 how i print this program??

5 Answers   DSR Management, Winit,


Categories