What is difference between #define and const?

Answers were Sorted based on User's Feedback



What is difference between #define and const?..

Answer / sarath

#define is the macro,const is modifier forexample const is
used in theb program we can not modify the data

Is This Answer Correct ?    10 Yes 1 No

What is difference between #define and const?..

Answer / sirin

#define MAX 100 - create constant with no type information
const int max = 100 - with type information

Is This Answer Correct ?    6 Yes 0 No

What is difference between #define and const?..

Answer / chitransha seth

with # define u can always undefine the variable by using
# undef but a const once defined cannot be altered

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More OOPS Interview Questions

What is the default size allocated for array in the statement if size not specified " int a[] "

4 Answers   CTS,


Is react oop?

0 Answers  


define oops concept with example

1 Answers   Cap Gemini,


What are the important components of cohesion?

0 Answers  


What will happen when the following code is run: int x; while(x<100) { cout<<x; x++; } 1) The computer will output "0123...99" 2) The computer will output "0123...100" 3) The output is undefined

7 Answers  






Base class has two public data members. How can i derive a new class with one datamember as public and another data member as private?.

2 Answers  


Can you explain polymorphism?

0 Answers  


write a short note on Overloading of Binary Operator?

2 Answers  


When a private constructer is being inherited from one class to another class and when the object is instantiated is the space reserved for this private variable in the memory??

13 Answers   HCL, Honeywell,


what is the difference between inter class and abstract class...?

0 Answers  


1. Define a class.

6 Answers  


4. What do you mean by a prototype? Define analysis prototype

1 Answers  


Categories