Good afternoon; I have a loop to get the main arguments that have been used in the command line, however, after removing them, the following cout are not shown. I understand that cout with < < receives reference variables. If I try to take out the argument argv [argc] that must be null (as indicated in, for example Stroustrup "The c ++ programming language" Special Ed. Point 6.1.7 Pag. 122), the following cout do not come out. It seems that the last parameter (null == argv [argc]) invalidates cout for some reason. I put a simple code that does not show End Adios.
#include <iostream>
using namespace std;
int main(int argc, char* argv[]) {
cout<<"Numero de parametros: "<<argc<<"\n";
for (int i=0; i<=argc; i++) // Aqui si ponemos argc-1 si sale bien
cout<<"valor de "<<i<<": "<<argv[i];
cout<<"\nFin\n";
cout<<"Adios\n";
return 0;
}
Could someone tell me what character or variable sends cout the last exit that makes the output of cout blocked?