Understanding Constants and Keywords in C: A Comprehensive Guide

C Character SetConstants and keywords in C

A character denotes any alphabet, digit or special symbol used to represent numbers and special characters allowed in C.

  • Alphabets: A, B, C,….. Z a, b, c……z
  • Numeric Digits:0,1,2,3,4,5,6,7,8,9.

Special Characters

+*/=%
&#!?^
~\|<>
()[]{}
:;.,

Constants

Constants represent fixed values. That means their value will not change in the program.

Constants in C

Integer Constants

  • An integer constant must have atleast one digit.
  • It must not have any decimal point.
EX:50
  +890
  -9609

Real Constants

  • Real constants are often called Floating point constants.
  • Real constants must have atleast one digit.
  • It must have a decimal point.
  • It could be either positive or negative.
EX:+564.98
    890.0

  -65.987
  +3.2e-5

Character Constants

Character constant is a single alphabet, a single digit or a single special symbol.

EX:'N'
   'S'

  'Navtutorials'

Keywords

Keywords cannot be used as variables.

autodoubleintstructbreakelselong
switchcaseenumregistertypedefexternretern
unionconstfloatsizeofunsignedcontinuefor
gotosignedvolatiledoifstaticwhile

Identifiers

  • first character must be an alphabet or underscore.
  • Must consist of only letters, digits or underscores.
  • Cannot be used a keyword.
  • Must not contain white space

Variables

  • A variable is a data name that may be used to store a data value.
  • Variables may take different values at different times during execution.
EX:  counter
      avg
      total
Invalid: 985
         *
Naveed Tawargeri
 

Hi, I'm Naveed Tawargeri, and I'm the owner and creator of this blog. I'm a Software Developer with a passion for Programming.