After I finished college, I didn't use C++. After 3 years of graphic design experience, I applied for an entry level C++ position and I received the questionnaire below. They said, I can use any reference book or ask to a senior person. Please help, I am trying to refresh my memory and I need this job...
LINE Contains Question
50 char * p;
201-300 /* we want to use ?p? here*/
2000 char * test()
2002 char buf;
2003-2050 /* unspecified, buf defined here *./
2051 return (char *) buf;
1. Is this a reasonable function?
2. Will it work at all?
3. Is it good practice, and why?
4. How, exactly, could one get a second ?char *? to use back from this function? Be specific in terms of the exact syntax needed. Another way to state this question is how can this function be modified to return a ?char *? from the function, and an additional ?char *? value in one function call. Please make sure that your answer will work even if the size of the char * desired is not known in the outside calling function. Avoid C++ syntax. Include statements in called and calling functions. Use good programming practice. Although alternatives are acceptable, for this question, please include an answer which maintains the original return type.
5.What might go between the parentheses in this particular situation in LINE 2000?
6. What is the construction ?(char *)? called and what does it do? What do the constructions of that name do in general in line 2051?