Constants in C interview questions

Total available count: 17
Subject - Programming Languages
Subsubject - Constants in C

What are the rules for defining symbolic constants?

  1. A symbolic constant is generally defined by writing  #define name text
  2. The rules for constructing the name part are the same as that for constructing identifiers. However, typically symbolic names are written in uppercase letters
  3. The text part can be a character constant, numeric constant or string constant
  4. # must be the first character in the line
  5. #define statements can appear anywhere within the program but before the symbolic constant is referenced in the program. Normally they are placed at the beginning of the program
  6. #define statements must not end with a semicolon, since they are preprocessor directives (like #include) and not executable C statements

Next 5 interview question(s)

What is Character Constant and explain the rules?

What is Constant?

What is Floating Point Constant?
What is Integer Constant?
What is String Constant?