c********v 发帖数: 21 | 1 2 hours
ssh programming:
1. Write a generic [template ] stack class.
1.1 write the interface, [push,pop...]
1.2 implement push
1.3 how to use it for array of stacks.
2. what's the output of the following program
2.1
int main() {
char * s="12345";
printf("%d\n",s);
}
what is the output?
what is the value in memory of the byte that is pointed by s?
2.2
int get() {
static int n = 0;
return ++n;
}
int printf( char const * fmt, ... ) {
// breakpoint
...
}
int main() {
printf ( "%d %d\n", get(), get() );
}
what is the output?
why? what is the stack layout during the time of breakpoint?
RIGHT-TO-LEFT stack(top)
sp:
sp+4:
sp+8:
sp+12:
sp+16: <-- first thing pushed, last to be popped
(bottom) | s****n 发帖数: 220 | 2 cong~感谢lz,太及时了,半个小时后就要面了,
顺便问下,这个公司如何啊。。 |
|