What are the different ways to define constants in the C programming language?

  1. Integral constants are defined using integer literals such as 10, -5, etc.
  2. Floating-point constants are defined using floating-point literals, such as 3.14, -0.5, and so on.
  3. Character constants are defined within single quotes, such as ‘x’ and ‘A’.
  4. String constant: a sequence of characters enclosed in double quotation marks, such as “Hello, World!”.
  5. Symbolic constants are defined using the #define preprocessor directive, such as #define PI 3.14159.
Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds