摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main() 5 { 6 int i = 1, j = 1; 7 for(; i <= 5; i++) 8 { 9 for(j = 1; j <= 5 - i; j++)10 {11 printf("%s", " ");12 }13 for(j = 1; j <= 2 * i - 1; j++)14 {15 printf("%s", "*... 阅读全文
posted @ 2013-03-17 23:19 mender 阅读(120) 评论(0) 推荐(0) 编辑
摘要: C语言中sizeof是一个运算符,strlen是string.h中的库函数sizeof计算的是变量申请的内存空间大小,strlen计算的是数组从第一个位置到'\0'所占的内存大小 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 5 void fun(char* a) 6 { 7 printf("fun:: sizeof(a) = %d\tstrlen(a) = %d\n", sizeof(a), strlen(a)); 8 int i = 阅读全文
posted @ 2013-03-17 21:29 mender 阅读(149) 评论(0) 推荐(0) 编辑