473,406 Members | 2,378 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.

why sizeof is not changing the value

main()
{
int temp = 3;
int x = sizeof(temp++);
printf("%d\n", temp);
}

In the above piece of code. I find that variable temp is not changed after sizeof operation. Can anyone tell me what is the reason for this.
Aug 25 '10 #1
2 1215
Meetee
931 Expert Mod 512MB
sizeof returns the size of the type of the variable which is 4 in this case (integer type). sizeof is performed at compile-time with the type of the variable. It doesn't do any evaluation on value of variable.

Please use code quotes around your piece of code.
Aug 25 '10 #2
donbock
2,426 Expert 2GB
Annex J.1 of the C99 specification provides a list of situations that produce unspecified behavior. The following item from that list is germane to your question:
Whether or not a size expression is evaluated when it is part of the operand of a sizeof operator and changing the value of the size expression would not affect the result of the operator (6.7.5.2).
Aug 27 '10 #3

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

Similar topics

2
by: Urs Vogel | last post by:
Hi When using XmlDocument, I can create nodes and attributes as I like. What I didn't achieve is changing the Value of a node (created with createElement), it claims that it's the wrong node...
0
by: sienayr | last post by:
Greetings, I have searched hi and lo through the groups and haven't found my problem specifically. I have listed below what I have tried based on what I have found in the groups. Please let me...
10
by: Daniel | last post by:
how to make two references to one string that stay refered to the same string reguardless of the changing value in the string?
4
by: David Coffin | last post by:
I'd like to subclass int to support list access, treating the integer as if it were a list of bits. Assigning bits to particular indices involves changing the value of the integer itself, but...
1
by: shankwheat | last post by:
I've been using this little script to change the <a href=""></a> value of a link which works well. <script language="javascript" type="text/javascript"> function ordering(sorder) { var link =...
11
by: saurabh | last post by:
Can anybody tell me how to change the value of an html control from the c#.... eg i hv one asp.net radio button control and one html hidden variable... so on page load in case the radio button is...
1
by: pigeonrandle | last post by:
Hi, I thought i should give a better explanation to my second 'bug' in my previous post (Bugs in VS2003 SP1) because it's taken me ages to figure out what was going on. Basically, one of my...
0
gsgurdeep
by: gsgurdeep | last post by:
please tell me the way of changing the value of a variable of an module. and i want to parmanent save the changes for later use before the next change.
2
by: samonline | last post by:
Dear friends, I have written a little program to read the source of a web page into a Rich Text Box. Now I want to find a specific integer value in that text box and take it into a variable. That...
1
by: Andrus | last post by:
I have rdl report in xml like below. I need to wrap all label <Valuetag contents to =Res.IR method call. For example <Value>ProductId</Value> should be replaced with ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.