pwaring,
@pwaring@fosstodon.org avatar

Fun things I have (re)learnt about C recently:

  1. int isn't guaranteed to be the same as the word size, only >= 16 bits.

  2. getchar returns int, not a char.

  3. Character literals are also int.

  4. You can get the numeric value of a character literal digit c with: c - '0'. This assumes that 0-9 are sequential, which is true for any encoding you're likely to meet, and required from C89 onwards (see Baudot code for an example which does not meet this criterion).

#c

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • ngwrru68w68
  • tester
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • mdbf
  • tacticalgear
  • megavids
  • osvaldo12
  • normalnudes
  • cubers
  • cisconetworking
  • everett
  • GTA5RPClips
  • ethstaker
  • Leos
  • provamag3
  • anitta
  • modclub
  • JUstTest
  • lostlight
  • All magazines