0

Hi guys I'm new with C++, whats the difference between using const int n=1 and int n=1 , I dont understant what does const do. Can you give me examples or something?

Embedded C
  • 1,448
  • 3
  • 16
  • 29
Reyneer Leon
  • 356
  • 2
  • 14

1 Answers1

2

With const int n=1 you cannot modify the value of n in your code, for example if you try to do n= 4 then it would cause an error, but with simple int n=1; you can always modify the value of n in your code like this

n= 4;
n=7;
Zia Qamar
  • 1,694
  • 1
  • 15
  • 35