How to change constant values?

Answers were Sorted based on User's Feedback



How to change constant values?..

Answer / ravi

Make it as mutable

Is This Answer Correct ?    14 Yes 3 No

How to change constant values?..

Answer / udit

const int var=10;
*(int *)&var=20;
this syntex change the constat value

Is This Answer Correct ?    15 Yes 10 No

How to change constant values?..

Answer / rajesh

use const_cast<...>

Is This Answer Correct ?    6 Yes 2 No

How to change constant values?..

Answer / ravi

can't change untill recomile

Is This Answer Correct ?    0 Yes 1 No

How to change constant values?..

Answer / asif karim

#include <stdio.h>
#include<iostream>
using namespace std;

void main()
{
const int var=10;
int a;
a=*(int* )& var=20;
cout<<a;
}

Is This Answer Correct ?    3 Yes 10 No

How to change constant values?..

Answer / edward

you can't change

Is This Answer Correct ?    5 Yes 13 No

Post New Answer

More C++ General Interview Questions

How do you clear a map in c++?

0 Answers  


What is the default access level?

0 Answers  


List out function which we can call without using object

1 Answers  


What are the new features that iso/ansi c++ has added to original c++ specifications?

0 Answers  


Explain the difference between c & c++?

0 Answers  






What's c++ used for?

0 Answers  


What are static and dynamic type checking?

0 Answers  


How do you traverse a btree in backward in-order?

0 Answers  


What is the Difference between "C structure" and "C++ structure"?

12 Answers  


Why was c++ made?

0 Answers  


What is class invariant?

1 Answers  


Write a program to calculate the following i want a c++program for this condition 1+4+9+16+….+100 Like this (1^2+2^2) Hint use function pow(a,b)

4 Answers   HTC, TCS,


Categories