由买买提看人间百态

topics

全部话题 - 话题: lookupname
(共0页)
M**Y
发帖数: 431
1
来自主题: JobHunting版 - 几道面试小题
1. With these variable declarations: int i, j[10], *k;
Which of the following are legal?
a. i = *(&(j[2]) + 1);
b. k = &(j[1]);
c. i = &(j[2]) + 1;
2. Assuming the function lookupName is defined, what's wrong with this code
(hint: 2 bugs)?
const char *getName(const char *c) {
std::string name = lookupName(c);
if (name == NULL)
return "Anonymous";
return name.c_str();
}
int main(int argc, char *argv[]) {
const char *name = NULL, *c = NULL;
if (argc >= 2)
c = ar
(共0页)