Three reasons.
Firstly, it makes mistakes less likely when I write the code. If the same value, with the same meaning, is meant to be used in many places, manually typing it in each time increases the chance of error.
1 2
|
int age[3];
string name[2]; // made a mistake here
|
If this value is spread throughout the code, the chances of making a mistake why typing it in are increased.
Secondly, it carries meaning for the reader. If I see the number 3 used, I don't know why that was used. Does it matter? What does it represent? If I see the word SIZE, I know it's meant to represent the size of something. It makes the code more meaningful, making it easier to understand and easier to fix mistakes.
Thirdly, if I ever need to change the value from 3 to 7, or 9, or anything, I only have one place to change it:
const int SIZE = 3;
Change it here, and everything else in the code that uses SIZE now has the correct, new value. Massively reduces the chances of making mistakes.