It is not good to return a reference or pointer to the local variable.
My question is the function 'beginComment' and 'endComment' are correct functions
If anyone is correct, why
Thank you
#include <iostream>
#include <vector>
using namespace std;
const char * beginComment()
{
return "[";
}
const char * endComment()
{
char * p = "]";
return p;
}
int main( )
{
cout << beginComment() << endl;
cout << endComment() << endl;
return 0;
}