Poll Results
No votes. Be the first one to vote.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
B. int const var = 10;
In C, you can declare a constant using the `#define` preprocessor or the `const` keyword.
1. Using `#define`:
#define PI 3.14
This tells the preprocessor to replace all occurrences of `PI` with `3.14` during compilation.
2. Using `const`:
“`c
const float pi = 3.14;
This tells the compiler that the variable `pi` is a constant, which means its value cannot be altered throughout the program.
Both methods are correct for declaring a constant in C, with the choice depending on the specific needs and context of your program.