CCoding Style - Magic Numbers

From EdWiki

Revision as of 09:30, 23 June 2015 by Jshankar (Talk | contribs) (1 revision imported: EdWiki -- Emsys pages from Shukra)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Magic Numbers

  • Magic numbers are the constants, array sizes, character positions, conversion factors and other literal numeric values that appear in program.
  • Give names to magic numbers.
  • Define numbers as constants, not macros
  • Use character constants, not integers
  • Use the language to calculate the size of an object.