你是不是暗恋我,那就给我发个消息呀,让我知道o(∩∩)o
发布时间:2013-01-07 20:43:35
strtok()函数的第一个参数不能是char *型的,因为会段错误#include <string.h>#include <stdio.h>int main(void){char *input= "wo:you:content",out[16];char *p,*q,*con,*p1,*q1,*con1;/**/ /* strtok places a NULL terminatorin front of the token, if found */sprintf(out,"%s","sdfg:sdfk:jdg");p1 = strtok(out, ":");q1 = ......【阅读全文】
发布时间:2013-01-07 20:03:18
最近做实验,用到strcpy()较多,经常出现段错误很是气人,就开始怀疑那些搜到的资料有点小问题,以下是我的测试结果:char *a, *b;char m[5],n[5];char x[5][5],y[5][5];strcpy( a , b ) 出现段错误;strcpy( a , x[3] ) 出现段错误;strcpy( a , m ) 出现段错误;strcpy( x[3] , b ) 没问题;strcpy( x[3] , y[2] ) 没问题;strcpy( m , n ) 没问题;对char *赋值a=b 没问题;a=m 没问题;a=x[2] 没问题;m=a 错误;x[2]=a 错误;总结......【阅读全文】
发布时间:2012-04-17 12:50:54
<span style="font-family: ; mso-ascii-font-fa......【阅读全文】