#include
using namespace std;
/*
int main(){
printf("Hello world\n");
return 0;
}
*/
//Example #3 (C++ code): What is the bug and why is it a problem?
const char* append(const char* s1, const char* s2) {
string s(s1);
s += s2;
return s.c_str();
}
void foo() {
const char* total = append("abc", "def");
}
/*
//Example #4 (C++ code): What is the bug and why is it a problem?
void erase(list &l, int v) {
list::iterator i = l.begin();
for(; i != l.end(); ++i) {
if(*i == v)
l.erase(i);
}
}
//Example #11 (C++ code): What is the bug and why is it a problem?
class Base {
public:
int x;
};
class Derived : public Base {
public:
int y;
};
void init(Base *b) {
for( int i = 0; i < 3; ++i) {
b[i].x = 0;
}
}
void foo() {
Derived arr[3];
init(arr);
}
*/