📄 arithtic_two_four.cpp
字号:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define Elemtype int
typedef struct{
Elemtype *elem;
int Lenth;
}Sqlist;
char InitList(Sqlist &L)
{
L.elem=(Elemtype *)malloc(11*sizeof(Elemtype));//切忌在分配内存时应当用SIZEOF 计算单元值
if (L.elem==NULL) return 0;
L.Lenth=10;
return 1;
}
char ListInsert(Sqlist &L,Elemtype B,int i)
{
Elemtype *P,*Q;
if(i<1||i>=L.Lenth)return 0;
P=&L.elem[i-1];
for(Q=&(L.elem[L.Lenth-1]);Q>=P;Q--)*(Q+1)=*Q;
*P=B;
L.Lenth++;
return 1;
}
void main()
{
Sqlist K;
InitList(K);
ListInsert(K,5,2);
printf("%d",K.elem[1]);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -