473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

what will be the output of following program? please explain.

int i=4,x;
x=++i+ ++i+ ++i;
printf("%d",x)
Jun 3 '15 #1
1 1360
weaknessforcats
9,208 Expert Mod 8TB
The result is indeterminate.

The rule is that a variable can be changed only once in a statement.

The compiler is free to calculate variable values in any order it chooses. So if the variable is changed more than once in the statement, different compilers will get different answers.
Jun 3 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: petermichaux | last post by:
Hi, If i have the following URI http://localhost/shop/index.php?CategoryID=4,2 what will the following be? (int)$_GET
2
by: mikelinyoho | last post by:
Does the following program architecture make sense? #include <stdio.h> #include "test1.c" #include "sample.cpp" int main(void){ output();
10
by: sunny | last post by:
Does this following program implement the factory design.if not what are things that i have to change in order to make this following program to be designed to factory design pattern. ...
3
by: doc | last post by:
What will a flash xml client socket connect to? I have a working php TCP/IP server socket bound to a port >1023 and the flash client will not even connect to it. I can connect to it with non-xml...
0
by: Reetesh Mukul | last post by:
On Apr 11, 12:06 pm, Rahul <sam_...@yahoo.co.inwrote: I am not sure, but compiler passes func1(this); In your case this == NULL. However since func1(...) is not accessing 'this', so things...
2
by: chiragkhimani | last post by:
void main { int j=++i + ++i + ++i; printf("%d",j); }
3
by: CBnasa | last post by:
I have a program written in C, that was written by a co-worker. I want to add a line of code that will output certain structures that are within a If loop inside the program, to a text file. How do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.