Jump to content

Talk:C Programming/Variables

Page contents not supported in other languages.
Add topic
From Wikibooks, open books for an open world
Latest comment: 2 years ago by Kai Burghardt in topic missing int8_t, uint16_t, etc.

C level one doubt

[edit source]

main() { int a=5,b=2; printf("%d", a+++b); }

what will be the output?? — Preceding unsigned comment added by 115.241.34.90 (talkcontribs)

You could just try it. It outputs 7. I guess the question is whether a+++b is interpreted as a++ +b (it is), or as a+ ++b. This sort of question never occurs to me because I make effective use of whitespace when I write code. Ambiguous code is hard to maintain, and is therefore bad code. --Jomegat (discusscontribs) 15:36, 22 September 2011 (UTC)Reply

Contents/In this section

[edit source]

At the end of the page there is a section about Contents and In this section These do not appear correct as they mention arrays, which are not discussed there. MadCowpoke (discusscontribs) 05:52, 21 May 2012 (UTC)Reply

missing int8_t, uint16_t, etc.

[edit source]

Hi! I find it more and more important to think about different processor architectures (16 bit, 32 bit, 64 bit...). In general it's a good idea to determine how "big" your integer variables need to be. Therefore I think it might be good to mention these specific integer data types.
Further more, it should be shown that integer variables can be split bitwise. Example:

  • uint16_t nibble1:4, nibble2:4, nibble3:4, nibble4:4;
  • uint8_t bit0:1, bit1:1, threebits:3;

What do you think about this? Maybe it's not that important for a beginner's guide... I don't know... --Lexikorn (discusscontribs) 07:22, 8 January 2023 (UTC)Reply

@Lexikorn: The C ISO standards declare the uintN_t types optional. I think this chapter is really too early to address such details. ‑‑ Kai Burghardt (discusscontribs) 17:44, 10 January 2023 (UTC)Reply