标签:style blog http io color ar 使用 for sp
#include <stdio.h> #include <string.h> int main(void) { char s[5]; memset(s,‘A‘,sizeof(s)); s[5]=‘\0‘; puts(s); return 0; }
2、初始化数组(注意:初始化为0正确实现,其他初始值还是通过循环语句实现)
#include <stdio.h> #include <string.h> int main(void) { int i,array1[5],array2[5]; memset(array1,0,sizeof(array1)); for(i=0; i<5; ++i) printf("%d ",array1[i]); printf("\n"); memset(array2,1,sizeof(array2)); for(i=0; i<5; ++i) printf("%d ",array2[i]); return 0; }
标签:style blog http io color ar 使用 for sp
原文地址:http://www.cnblogs.com/elie/p/4060598.html