摘要:
时间按复杂度 空间复杂度 编码复杂度 阅读全文
posted @ 2019-07-05 14:18
kkkshiki
阅读(191)
评论(0)
推荐(0)
|
摘要:
若想要手动提供id和gender初始化参数 或者: 这样可以直接在需要时对结构体变量赋值: 只要参数个数和类型不完全相同可以定义多个构造函数 应用实例:结构体Point 用于存放平面点的坐标x,y 1 #include <stdio.h> 2 3 struct Point{ 4 int x,y; 5 阅读全文
posted @ 2019-07-05 14:16
kkkshiki
阅读(493)
评论(0)
推荐(0)
摘要:
对引用变量的操作就是对原变量的操作 1 #include <stdio.h> 2 3 void change(int&x){ 4 x=1; 5 } 6 int main(){ 7 int x=10; 8 change(x); 9 printf("%d\n",x); 10 return 0; 11 } 阅读全文
posted @ 2019-07-05 13:44
kkkshiki
阅读(131)
评论(0)
推荐(0)
摘要:
1 #include <stdio.h> 2 3 void change (int *p){ 4 *p=233; 5 } 6 7 /*将变量的地址传入函数。在函数中对地址的元素进行改变,原先的数据也会改变*/ 8 int main(){ 9 int a=1; 10 int *p=&a; 11 cha 阅读全文
posted @ 2019-07-05 13:38
kkkshiki
阅读(197)
评论(0)
推荐(0)
摘要:
1 #include <stdio.h> 2 3 /*数组名称也作为数组的首地址使用*/ 4 int main(){ 5 int a[10]={1}; 6 int *p=a; 7 printf("%d\n",*p); 8 return 0; 9 } 1 #include <stdio.h> 2 3 阅读全文
posted @ 2019-07-05 09:10
kkkshiki
阅读(191)
评论(0)
推荐(0)
摘要:
1 #include <stdio.h> 2 3 /*在变量前面加上&就可以表示变量的地址*/ 4 int main(){ 5 int a=1; 6 printf("%d,%d\n",&a,a); 7 return 0; 8 } 指针变量 int* p; double* p; char* p; in 阅读全文
posted @ 2019-07-05 09:09
kkkshiki
阅读(147)
评论(0)
推荐(0)
摘要:
1 #include <stdio.h> 2 3 int max_2(int a,int b){ 4 if(a>b) return a; 5 else return b; 6 } 7 8 /*在max_3中调用max_2比较大小*/ 9 int max_3(int a,int b,int c){ 1 阅读全文
posted @ 2019-07-05 08:42
kkkshiki
阅读(268)
评论(0)
推荐(0)
摘要:
strlen()可以得到字符数组中第一个\0前的字符的个数 1 #include <stdio.h> 2 #include <string.h> 3 4 int main(){ 5 char str [10]; 6 gets(str); 7 int len=strlen(str); 8 printf 阅读全文
posted @ 2019-07-05 00:05
kkkshiki
阅读(280)
评论(0)
推荐(0)
摘要:
1 #include <stdio.h> 2 3 int main(){ 4 char str[15]={'G','o','o','d',' ','s','t','o','r','y','!'}; 5 int i; 6 for(i=0;i<11;i++){ 7 printf("%c",str[i]) 阅读全文
posted @ 2019-07-04 22:01
kkkshiki
阅读(134)
评论(0)
推荐(0)
摘要:
int a[5][6]; doube db[10][10]; char [256][256]; bool vis[1000][1000]; 1 #include <stdio.h> 2 3 int main(){ 4 int a[5][6]={{3,1,2},{8,4},{},{1,2,3,4,5} 阅读全文
posted @ 2019-07-04 15:18
kkkshiki
阅读(376)
评论(0)
推荐(0)
|