find out any problem in the following code peices if there exists, and point out what
is it.
[ i give you 5 minutes if you are interested. you will notcolor=red> be paid. these are some of the questions one company shows to the
interviewers. i just want to figure out if these questions are too difficult or too
easy. ]
[ i won't tell you the name of the company, and if you know, don't speak it out. i am
NOT interested in your comments on the questions.
PLEASE HELP. ]
a)
int getval (int const * pval)
{
if (pval != NULL)
return *pval;
}
b)
char* stringcopy (const char *str) /* str: null-terminated string */
{
int len;
char *buf;
len = strlen (str);
buf = (char *)malloc (len);
strcpy (buf, str);
return buf;
}