This is a question from the book I am learning c++ from. It just says:
6.21- Identify and correct the errors int he following program:
void p(int i)
{
int i = 5;
cout << "i is " << i << endl;
}
I'm not sure what is wrong with this code. I think it probably has to do with the argument of p. When I try to build it in sublime text it says "error: redefinition of 'i'"
If it helps, we are learning about local, static and global variables.
Thanks!
Aucun commentaire:
Enregistrer un commentaire