I have this function:
char* return_string(){
char buffer[] = "Hi world!";
return buffer;
}
bool test08()
{
char compare[] = "Hi world!";
int result = strcmp(compare,return_string());
if (result == 0) return true;
return false;
}
int main()
{
if(test08) printf("\nTRUE");
else printf("\nFALSE");
}
Why this code run in c++ Shell and it doesn't in codeblocks v. 13.12 (Segmentation fault); it'll work if i change my char buffer[]=
declaration to char *buffer=;
i'm a beginner at C++ (easy to know) so please be clear...