摘要: 链接:http://blog.csdn.net/xuleicsu/article/details/919801more info:http://guoyiqi.iteye.com/blog/1626922http://www.wutianqi.com/?p=1822http://www.cnblogs.com/bigshow/archive/2009/01/03/1367661.html如何将二维数组作为函数的参数传递今天写程序的时候要用到二维数组作参数传给一个函数,我发现将二维数组作参数进行传递还不是想象得那么简单里,但是最后我也解决了遇到的问题,所以这篇文章主要介绍如何处理二维数组当作参数 阅读全文
posted @ 2013-06-03 16:23 菜鸟的世界 阅读(10657) 评论(2) 推荐(3) 编辑
摘要: In C, what's the difference betweenchar *s="Hello"; andchar s[]="hello";The difference here is thatchar*s ="Hello";will place Hello in the read-only parts of the memory and making s a pointer to that, making any writing operation on this memory illegal. While doing: 阅读全文
posted @ 2013-06-03 15:42 菜鸟的世界 阅读(217) 评论(0) 推荐(0) 编辑
摘要: strcpy 与 strcat是两个常用的字符串处理的函数,经常可以用来给一个空的字符串赋值。example:char a[]="abcd";char b[5];strcpy(b, "");strncpy(b, a, 4);printf("b:%s\n", b);上面这段代码的输出结果为:abcd烫烫为什么在abcd之后会出现乱码呢?查了资料之后发现strcpy(strncpy)不会自动在字符串之后添加终止符。当把strncpy换成strncat之后,程序就能正常运行了,这是因为strncat会自动添加终止符,但是这要求b有足够的si 阅读全文
posted @ 2013-06-03 15:26 菜鸟的世界 阅读(669) 评论(0) 推荐(0) 编辑