M
Mohammad Omer
I am using vs2k5 for C++ IDE. I need to understand concept of the
following Code behavior on VC compiler.
Code-1
---
Object getObject()
{
return Object();
}
<In main function>
Object obj;
Obj = getObject();
Code-2
---
char * getTestArray()
{
char str[256];
strcpy(str, "this Text");
return str;
}
<In main function>
char text[256];
strcpy(text, getTestArray());
I really need answer of the following question,
1. What is the difference in code-1 and code-2 returning?
2. Will "strcpy(text, getTestArray());" statement make some problem in
feature??
Regards,
-aims
following Code behavior on VC compiler.
Code-1
---
Object getObject()
{
return Object();
}
<In main function>
Object obj;
Obj = getObject();
Code-2
---
char * getTestArray()
{
char str[256];
strcpy(str, "this Text");
return str;
}
<In main function>
char text[256];
strcpy(text, getTestArray());
I really need answer of the following question,
1. What is the difference in code-1 and code-2 returning?
2. Will "strcpy(text, getTestArray());" statement make some problem in
feature??
Regards,
-aims