Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

what will be the output?

This is a discussion on what will be the output? within the C and C++ forums, part of the Software Development category; x=5 y=++x * ++x what will be the value of y?...

Go Back   Geeks Talk > Software Development > C and C++
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 10-26-2007
Junior Member
 
Join Date: Jul 2007
Location: Mumbai
Posts: 17
Thanks: 1
Thanked 6 Times in 5 Posts
mahesh9920 is on a distinguished road
Question what will be the output?

x=5
y=++x * ++x

what will be the value of y?
Reply With Quote
The Following User Says Thank You to mahesh9920 For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 10-27-2007
Contributing Member
 
Join Date: Oct 2007
Location: India
Posts: 35
Thanks: 10
Thanked 1 Time in 1 Post
amar1_001 is on a distinguished road
Re: what will be the output?

49 , but i can't understand the logic pls tell
Reply With Quote
  #3 (permalink)  
Old 10-27-2007
Contributing Member
 
Join Date: Mar 2007
Location: renukoot(sonbhadra)
Posts: 39
Thanks: 5
Thanked 4 Times in 4 Posts
rohit dwivedi9450 is on a distinguished road
Re: what will be the output?

43
scanning from left
5+1=6*6+1=7=42+1
43
Reply With Quote
  #4 (permalink)  
Old 10-29-2007
Contributing Member
 
Join Date: Oct 2007
Location: India
Posts: 35
Thanks: 10
Thanked 1 Time in 1 Post
amar1_001 is on a distinguished road
Re: what will be the output?

hello, rohit
when i run this code the result is 49 not 43?
Reply With Quote
  #5 (permalink)  
Old 10-29-2007
Junior Member
 
Join Date: Oct 2007
Location: india
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
kareem is on a distinguished road
Re: what will be the output?

i am not sure how the compiler works , 43 or 49. please tell sir

Last edited by kareem; 10-29-2007 at 05:43 AM. Reason: want to know more
Reply With Quote
  #6 (permalink)  
Old 10-29-2007
Junior Member
 
Join Date: Oct 2007
Location: nagpur
Posts: 4
Thanks: 1
Thanked 1 Time in 1 Post
maddy19 is on a distinguished road
Re: what will be the output?

Quote:
Originally Posted by mahesh9920 View Post
x=5
y=++x * ++x

what will be the value of y?
the o/p of code is
42
Reply With Quote
  #7 (permalink)  
Old 10-29-2007
Contributing Member
 
Join Date: Oct 2007
Location: trichy
Posts: 92
Thanks: 2
Thanked 13 Times in 9 Posts
sarathi trichy is on a distinguished road
Smile Re: what will be the output?

Quote:
Originally Posted by mahesh9920 View Post
x=5
y=++x * ++x

what will be the value of y?
the value is assigined only in left side

a=5;
b= 7*7;
b=49
b=++a*++a;
*(7);
(7)
b=7*7;
b=49;
Reply With Quote
  #8 (permalink)  
Old 10-31-2007
Junior Member
 
Join Date: Oct 2007
Location: uttarpradesh(india)
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
gauravsingh1986 is on a distinguished road
Re: what will be the output?

hi!! answer will be 49.bcz firstly++ poerates than *
Reply With Quote
  #9 (permalink)  
Old 10-31-2007
Junior Member
 
Join Date: Oct 2007
Location: uttarpradesh(india)
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
gauravsingh1986 is on a distinguished road
Re: what will be the output?

Quote:
Originally Posted by amar1_001 View Post
49 , but i can't understand the logic pls tell
hi amar. answer is 49 bcz firstly ++ operates two times so x becomes 7 and then 7*7=49
Reply With Quote
Reply

  Geeks Talk > Software Development > C and C++

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
What is a output?. How will Come?. Golda C and C++ 28 10-03-2009 08:21 AM
First output value is getting overwritten by second output Geek_Guest QTP 2 01-05-2008 04:40 AM
How many records in output Geek_Guest SQL 7 11-10-2007 01:30 AM
Output Value bharathi_ark Testing Issues 5 12-27-2006 07:13 AM
Output Functions RyanJames C and C++ 5 12-20-2006 03:10 AM


All times are GMT -4. The time now is 10:16 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved