Home  Interview Questions  Certifications  Aptitude Questions  Tutorials  Placement Papers  Search  Resume  Soft Skills  Video  Forum  Blog

Android app on Google Play

Technical Interview Questions

Java Interview Questions
Unix Interview Questions
SQL Interview Questions
C# Interview Questions

Aptitude Interview Questions
C/C++ Aptitude Questions
C Aptitude Questions

C Tutorial
C++ Tutorial

Programming Source Codes
C/C++ Source Codes
C# Source Codes

Online Quiz
C Online Quiz
C++ Online Quiz


Home > C Interview Questions >

What is the benefit of using const for declaring constants ?

 The benefit of using the const keyword is that the compiler might be able to make optimizations based on the knowledge that the value of the variable will not change. In addition, the compiler will try to ensure that the values wonít be changed inadvertently.

Of course, the same benefits apply to #defined constants. The reason to use const rather than #define to define a constant is that a const variable can be of any type (such as a struct, which canít be represented by a #defined constant).

Also, because a const variable is a real variable, it has an address that can be used, if needed, and it resides in only one place in memory

<< Go Back to C Interview Questions. 

Have a Question ? post your questions here. It will be answered as soon as possible.

Check Object Oriented Interview Questions for more Object Oriented Interview Questions with answers

Check Data Structure Interview Questions for more data structure interview questions with answers