A
arnuld
#include <iostream>
#include <limits>
int main()
{
std::string s1;
std::cout << s1[10] << std::endl;
return 0;
}
[arnuld@arch cpp ]% g++ -ansi -pedantic -Wall -Wextra test.cpp
[arnuld@arch cpp ]% ./a.out
[arnuld@arch cpp ]%
this programme compiles and runs without any trouble. why i do not get any
error (because the string is empty and i am trying to access 9th
character).
is it a valid C++ programme ?
#include <limits>
int main()
{
std::string s1;
std::cout << s1[10] << std::endl;
return 0;
}
[arnuld@arch cpp ]% g++ -ansi -pedantic -Wall -Wextra test.cpp
[arnuld@arch cpp ]% ./a.out
[arnuld@arch cpp ]%
this programme compiles and runs without any trouble. why i do not get any
error (because the string is empty and i am trying to access 9th
character).
is it a valid C++ programme ?