cpluse

落雪的时候,鸟都不飞,云也不飘

 

2014年3月19日

C语言基础补习

摘要: scanf("%d,%d",&x,&y);在输入代码时多输入了一个逗号(结果导致x正确赋值,y如果没做初始化的话,值会为0xcccc),对我这种对C语言语法都不熟悉的人也不容易看出问题,但是在没看其他文档仅通过调试的情况下追踪到了问题原因,虽然极简单的小问题浪费了时间,不过也算了解到了调试的重要性。同样还有getchar(),愚笨的以为我输入一个字符,它返回一个字符,但是实验时却是输入一串字符按下回车,它打印一串字符,进一步看一下就知道getchar()是从输入流取一个字符并返回,并不是键盘输入一个字符他读取并返回,而是等待换行符才开始从输入流一个字符一个字 阅读全文

posted @ 2014-03-19 22:49 cpluse 阅读(176) 评论(0) 推荐(0)

Memory management in C programs (转)

摘要: One large difference between C and most other programming languages is that in C, you have to handle memory yourself rather than having a garbage collector do it for you. Ensuring that memory is allocated at the correct moment is not very difficult (and something that needs to be done manually in pr 阅读全文

posted @ 2014-03-19 22:26 cpluse 阅读(91) 评论(0) 推荐(0)

导航