自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 收藏
  • 关注

原创 pointer-parameter AND return type

#include<stdio.h>#include<stdlib.h>#define N 20struct cell{ struct cell* left; struct cell* right;};void f(int *t){ //复制的一个新的指针t,不是传进来的指针,是新的指针在来 回指向 int *a=(int*)mal.

2022-04-28 11:46:09 52

原创 mutishi addition

#include<stdio.h>#include<stdlib.h>struct nominal{ float num; int level; struct nominal* next;};struct nominal* creat (int n);struct nominal* add(struct nominal*p,struct nominal*q);void show(struct nominal*);void putin(float num0,int.

2021-12-28 15:06:25 296

原创 list task

delete repeted entry#include <stdio.h>#include <malloc.h>struct cell {//单链表结点结构体定义int x;struct cell* next;};struct cell* build(void) {//新建单链表,并将建好的单链表首结点地址返回struct cell* head, * tmp, * p;head = tmp = p = NULL;int n; head=(struct cel.

2021-12-28 15:05:21 477

原创 fundamental operations to a list.

//the first way-----find the first entry whose num is not key,and make it to be head#include<stdio.h>#include<stdlib.h>struct link{ int num; struct link*next;};struct link* creat(int n);void show(struct link*);struct link* del(struct.

2021-12-27 20:28:59 175

原创 find the biggest entry in an array(recurse)

#include<stdio.h>//from the endint cmp(int a,int b){ return (a>b)?a:b;}int find(int a[],int n){ //find the biggest in these n entries if(n==2) return cmp(a[0],a[1]); else{ return cmp(find(a,n-1),a[n-1]); //compare th.

2021-12-11 22:10:14 206

原创 resort an array

#include<stdio.h>void fun(int a[],int n){ //change the beginning of the array int t,*p=a; //change the first num of the array if(n==0||n==1) return; else { t=*p;*p=*(p+n-1);*(p+n-1)=t; n=n-2; fun(p+1,n); //change the next .

2021-12-11 19:55:20 517

原创 search an entry in the array .(recurse)

#include<stdio.h>//half-way search int search(int a[],int low,int up,int key){ int i=(low+up)/2; if(low>up) return -1; else if(a[i]==key) return i; else if(a[i]>key) return search(a,low,i-1,key); else if(a[i]<key) return search(a,i+1.

2021-12-11 14:14:24 396

原创 【无标题】sort str

#include<stdio.h>#include<string.h>void sort(char *name[],int n){ int i,j,min; char *ch; for(i=0;i<n-1;i++){ min=i; for(j=i+1;j<n;j++){ if(strcmp(name[j],name[min])<0) min=j; } ch=name[min];name[min]=name[i];name[i]=ch.

2021-12-09 19:44:05 94

原创 Delete all the aim numbers in an array.

#include <stdio.h> #include <string.h> void DelChar(char *str,char ch){ //char *str str is a point,an addrass int i,k; // same as str[],&str[0] for(i=0;str[i]!=0;i++){ if(str[i]==ch){.

2021-11-25 17:25:59 44

原创 Practice:sort scores with student numbers.

#include<stdio.h>#define n 5void sort1(int score[],int num[],int cnt);void sort2(int score[],int num[],int cnt);void sort3(int score[],int num[],int cnt);int main(void){ int i,score[n],num[n]; for(i=0;i<n;i++) { num[i]=i; scanf("%d",&a.

2021-11-23 15:57:09 342

原创 Two ways to search an entry in an array.

#include<stdio.h>#define n 5int search1(int key,int a[],int cnt){ int i,result=-1; for(i=0;i<cnt;i++){ if(a[i]==key){ result=i; break; } } return result;}int search2(int key,int a[],int cnt){ //only if the array is in order i.

2021-11-23 13:15:13 325

原创 three ways to sort an array.

#include<stdio.h>#define n 5void sort1(int a[],int cnt){ int i,t,min,j; for(i=0;i<cnt-1;i++){ min=i; for(j=i+1;j<cnt;j++){ if(a[j]<a[min]) min=j; } t=a[i]; a[i]=a[min]; a[min]=t; }}void sort2(int a[],int cnt){ int i,f.

2021-11-23 11:34:43 231

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除