R
ramif
Will there be a memory leak at strcpy(myString, foo()) or not???
#include <string.h>
#include <stdlib.h>
char * foo()
{
char *str = malloc(200);
if (str != NULL)
strcpy(str, "qwerty");
return str;
}
int main(int argc, char *argv[])
{
char * myString = malloc(200);
/******* Will a memory leak occures here? *******/
strcpy(myString, foo());
return 0;
}
#include <string.h>
#include <stdlib.h>
char * foo()
{
char *str = malloc(200);
if (str != NULL)
strcpy(str, "qwerty");
return str;
}
int main(int argc, char *argv[])
{
char * myString = malloc(200);
/******* Will a memory leak occures here? *******/
strcpy(myString, foo());
return 0;
}