background image

int data; 
linka* next; 
}; 
void reverse(linka*& head) { 
if(head ==NULL) 
return; 
linka *pre, *cur, *ne; 
pre=head; 
cur=head->next; 
while(cur) 

ne = cur->next; 
cur->next = pre; 
 pre = cur; 
cur = ne; 

head->next = NULL; 
head = pre; 

1.一只酒瓶装了半瓶酒,瓶口用软木塞塞住。请问:不损坏酒瓶、不拔去塞子或在塞子上
钻孔,怎样才能喝光瓶中的酒?
解答:把塞子弄进瓶子去就可以喝到了
3.死锁及去除法
所谓死锁: 是指两个或两个以上的进程在执行过程中,因争夺资源而造成的一种互相等待
的现象,若无外力作用,它们都将无法推进下去,解决死锁问题的三种方法:预防死锁、
检测

 

一个程序将操作系统分配给其运行的内存块分为 个区域

 

代码区 (code area) 

 

程序内存空间

 

全局数据区 (data area) 

 

堆区 (heap area) 

 

栈区 (stack area) 
字符串反转

 void reverse(char *s)
{

char temp;
char *end = s + strlen(s) - 1;

    while( end > s)
    {
        temp = *s;
        *s = *end;
        *end = temp;
        --end;
        ++s;