10 2021 档案

摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> void main() { char str[1024]; int i=0; printf("请输入一串字符:"); scanf("%s",str); while(str[i]!=' 阅读全文
posted @ 2021-10-07 22:15 major825 阅读(1697) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> void main() { char t[100]; char *p=t,*s=t; printf("输入字符串:"); gets(t); while(*p) { if(*p!=32) *s++=*p; p++; } *s='\0'; puts(t); } 阅读全文
posted @ 2021-10-07 22:12 major825 阅读(474) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2021-10-07 21:04 major825 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2021-10-07 20:58 major825 阅读(148) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 3 int a[8] = {0}; 4 void main(){ 5 int i; 6 int num,data; 7 printf("please input 7 number:"); 8 for(i = 0;i < 7;i++) 9 { 10 //pr 阅读全文
posted @ 2021-10-06 12:20 major825 阅读(129) 评论(0) 推荐(0) 编辑
摘要:1 #include <stdlib.h> 2 #include <stdio.h> 3 #define N 32 4 int my_atoi(char *s); 5 int main() 6 { 7 char a[N]; 8 scanf("%s", a); 9 int num = 0; 10 nu 阅读全文
posted @ 2021-10-06 11:31 major825 阅读(415) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> int fibo(int n) { if( n < 0) { return -1; }else if(n == 0 || n == 1){ return 1; } int ret = n*fibo(n-1); return ret; } int main(int 阅读全文
posted @ 2021-10-06 10:37 major825 阅读(300) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> int fibo(int n) { if( n == 0) { return 0; }else if(n == 1){ return 1; } return fibo(n-2) + fibo(n-1); } int main(int argc, const cha 阅读全文
posted @ 2021-10-06 10:32 major825 阅读(50) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> #include<assert.h> #include<string.h> #define N 50 // int my_strcmp(char *dest, char *src) // { // assert((dest != NULL)&&(src != NU 阅读全文
posted @ 2021-10-05 23:42 major825 阅读(100) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> #include<assert.h> #include<string.h> #define N 50 // char *my_strcat(char *dest, char *src) // { // assert((dest != NULL)&&(src != 阅读全文
posted @ 2021-10-05 22:53 major825 阅读(63) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 #include<assert.h> 3 #include<string.h> 4 5 #define N 20 6 char *my_strcpy(char *dest, char *src) 7 { 8 assert((dest != NULL)&&( 阅读全文
posted @ 2021-10-05 22:19 major825 阅读(88) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 #include<assert.h> 3 int my_strlen(const char *strDest) 4 { 5 6 assert(strDest != NULL);//断言:判断表达式一定为真,若为假,则终止程序 7 8 if(*strDest 阅读全文
posted @ 2021-10-05 20:07 major825 阅读(147) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 #include<assert.h> 3 unsigned int mystrlen(char *str) 4 { 5 unsigned int len = 0; 6 assert(str != NULL);//断言:判断表达式一定为真,若为假,则终止程序 阅读全文
posted @ 2021-10-05 19:39 major825 阅读(49) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 void sum(int num, int *x, int *y) 3 { 4 int flag = 0; 5 int i = 0; 6 *x = 0; 7 for(i = 0;i <= num; i = i+2)//变量的递增条件时i= i+2 8 { 阅读全文
posted @ 2021-10-05 17:39 major825 阅读(101) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 void swap(int *x, int *y) 3 { 4 int temp = 0; 5 temp = *x; 6 *x = *y; 7 *y = temp; 8 return; 9 } 10 11 int main(int argc, const 阅读全文
posted @ 2021-10-05 15:15 major825 阅读(70) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 int input_data(int *p,int len)//从键盘输入数据到数组 3 { 4 int i = 0; 5 for(i = 0; i < len; i++) 6 { 7 scanf("%d", &p[i]); 8 } 9 return 0; 阅读全文
posted @ 2021-10-05 15:02 major825 阅读(77) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 int input_data(int *p,int len)//从键盘输入10个数据 3 { 4 int i = 0; 5 for(i = 0; i < len; i++) 6 { 7 scanf("%d", &p[i]); 8 } 9 return 0; 阅读全文
posted @ 2021-10-05 12:09 major825 阅读(99) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h>char *fun1(char *p){ printf("%s\n", p); return p;}char *fun2(char *p){ printf("%s\n", p); return p;}char *fun3(char *p){ printf("%s\n 阅读全文
posted @ 2021-10-04 23:48 major825 阅读(75) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 char *fun1(char *p) 3 { 4 printf("%s\n", p); 5 return p; 6 } 7 char *fun2(char *p) 8 { 9 printf("%s\n", p); 10 return p; 11 } 12 阅读全文
posted @ 2021-10-04 23:22 major825 阅读(30) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 int ADD(int a,int b ) 3 { 4 return a + b; 5 } 6 int SUB(int a,int b ) 7 { 8 return a - b; 9 } 10 int MUL(int a,int b ) 11 { 12 r 阅读全文
posted @ 2021-10-04 22:39 major825 阅读(105) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 int add(int a,int b ) 3 { 4 return a + b; 5 } 6 int sub(int a,int b ) 7 { 8 return a - b; 9 } 10 int mul(int a,int b ) 11 { 12 r 阅读全文
posted @ 2021-10-04 22:15 major825 阅读(127) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 char **design_array()//这个函数定义了一个指针,就可以返回数组名 3 { 4 static char a[] = {"beijing"};//此时的a在函数内定义的局部变量,需要做为返回值,必须加static 5 static cha 阅读全文
posted @ 2021-10-04 20:29 major825 阅读(91) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 int *design_array(int *plan)//形参中定义的变量可以不用赋初值,就能直接用.这个函数定义了两个指针, 3 //就相当于可以返回两个变量:数组名和数组长度 4 { 5 static int a[5] = {10,20,30,40, 阅读全文
posted @ 2021-10-04 19:44 major825 阅读(50) 评论(0) 推荐(0) 编辑
摘要:1 //输入信息时形参只能用指针,输出信息时行参可以是指针、也可以是普通变量 2 #include<stdio.h> 3 #include <string.h> 4 #define MAX 5 5 6 struct student{ 7 char name[20]; 8 char id[10]; 9 阅读全文
posted @ 2021-10-04 14:10 major825 阅读(195) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 typedef struct{ 3 char name[20]; 4 int id; 5 int score; 6 }student; 7 8 student st[3] = { 9 {"jack",1,100}, 10 {"rose",2,80}, 11 阅读全文
posted @ 2021-10-02 22:29 major825 阅读(217) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 3 // typedef int *fun(int a,int b);//fun代表int *(int ,int ) 4 typedef int (*fun)(int a,int b);//fun代表int (*)(int ,int ) 5 int add 阅读全文
posted @ 2021-10-02 09:01 major825 阅读(140) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h> union data{ int a; char b; }dt; int main(int argc, const char *argv[]) { dt.a = 0x12345678; if(dt.b == 0x78) { printf("small\n"); } 阅读全文
posted @ 2021-10-02 08:14 major825 阅读(53) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示