- 博客(6)
- 收藏
- 关注
原创 将长度为n的数组arr后面m个数据移到最前面
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> #include<assert.h> void Move(int *arr,int n,int m) { if(arr==NULL||n<=0||n<m) { return...
2019-10-31 17:21:39
528
原创 写一个函数,输入一行字符,将此字符串中最长的单词输出
#include<stdio.h> #include<stdlib.h> #include<string.h> void MaxWord(const char *str) { char *maxstr=(char *)malloc((strlen(str)+1)*sizeof(char));
2019-10-31 16:38:01
2343
原创 写一个函数,将数字转换为字符串
比如1234->“1234” #include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> #include<assert.h> void Myitoa(char *buf,int n) { int i=0; do { buf[i++]...
2019-10-28 18:23:46
633
原创 写一个函数,使输入的一个字符串按反序存放,在主函数中输入和输出字符串
#include <stdio.h> #include<string.h> #include<stdlib.h> void Reverse (char *str) { char *p=str; char tmp; //找出字符串结尾 while(*p!='\0') p++; //p和str交换 for(p--;str<p;str++,p--)...
2019-10-28 17:53:31
2476
原创 结构体大小
typedef:定义类型,给一种数据类型起别名 结构体大小: 内存对齐:每个人数据存放的内存地址,能整除数据本身的大小(快速 1、前面所有成员的字节数能整除当前成员大小 2、结构体的大小必须能整除单个最大类型的大小 #include<stdio.h> #include<string.h> typedef struct A { float a;//4 int b;//4...
2019-05-26 17:52:37
225
原创 数字处理问题
数字处理问题 1、求出它是几位数 2、顺序输出各位数字 3、逆序输出各位数字 #include<stdio.h> #include<math.h> int GetFigures(int n) { int count=0; while(n!=0) { n/=10; count++; } return count; } void PrintOrder(int ...
2019-04-17 21:10:04
208
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人