|
![]() | 作者: TomyChen [tomychen]
![]() |
登录 |
某公司笔试题(缩略) 一题: 如果下面的代码有错,请指出; 1.printf ("%d%d%d",10); 2.#define ISDID(c) ((c>='0')&&(c<='9'))?1:0 3.char *p,str[256]; int len; gets(str); len=strlen(str); p=malloc(len); if (p!=NULL) strcpy(p,str); 二题: 用文写出下列的代码是如何工作的? main () { int fd; if (fd=open("output",O_CREAT|O_RDWR,0664))<=0) {printf ("con not open output file\n"); exit (-1); } close(1); dup(fd); close (fd); printf ("This is line 1\n"); exit (0); } 2. char int ToStr(unsigned short int i) { static char str[8]; sprintf ("str,%d",i); return str; } main () { int i,j; char *str1,*str2; for (i=0;i<3;i++) {str1=intToStr(i); for (j=0;i<3;j++) str2=intToStr(j); if (strcmp(str1,str2)) { write (1,"i=",2); write (1,str1,strlen(str1)); write (1,"j=",3); write (1,str2,strlen(str2)); write (1,"\n",1); } } exit (0); } 大家试试:0 |
地主 发表时间: 02/26 22:13 |
![]() | 回复: shesh [shesh] ![]() |
登录 |
靠,实际上机调试是最好的办法,哈哈. |
B1层 发表时间: 06/30 17:21 |
![]() | 回复: wangqi543 [wangqi543] ![]() |
登录 |
晕~~~~~~~看来期末考试C语言过不了了~~~~~~~ |
B2层 发表时间: 06/30 17:48 |
![]() | 回复: NetDemon [netdemon] ![]() |
登录 |
BC |
B3层 发表时间: 06/30 20:10 |
![]() | 回复: ywa [ywa] ![]() |
登录 |
[fly]这是什么[*fly] |
B4层 发表时间: 07/01 11:07 |
![]() | 回复: CShell [authen] ![]() |
登录 |
![]() |
B5层 发表时间: 06-02-24 16:10 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号