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

3. Differentiate verification and validation.

1 Answers  


What are objects in oop?

0 Answers  


What is data binding in oops?

0 Answers  


what i oops concept, how many languages supports oops concept?

3 Answers   Value Labs,


What is a class oop?

0 Answers  


What does the code "cout<<(0==0);" print? 1) 0 2) 1 3) Compiler error: Lvalue required

15 Answers   ISTS, Wipro,


Write a program to reverse a string using recursive function?

0 Answers   TCS,


What are callback functions in c++

1 Answers   SoftTech,


Which is the parameter that is added to every non-static member function when it is called?

3 Answers   Accenture,


difference between static and non-static variables?

2 Answers  


What is balance factor?

0 Answers  


What is a macro? And how is a macro same as a template?

4 Answers  


Categories