更新了文件名。开始了数据结构

This commit is contained in:
lzy
2024-04-14 06:55:53 +08:00
parent 9bc7edbf47
commit 45bcb90c6d
69 changed files with 455 additions and 0 deletions

35
Chapter06/point_arr.c Normal file
View File

@@ -0,0 +1,35 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *name[5] = {"Follow me", "Basic", "Great", "Fortran", "Computer"};
// 指针数组
int i, j, k;
char *tmp;
for (i = 0; i < 5 - 1; i++)
{
k = i;
for (j = i + 1; j < 5; j++)
{
if (strcmp(name[k], name[j]) > 0)
k = j;
}
if (k != j)
{
tmp = name[i];
name[i] = name[k];
name[k] = tmp;
}
}
for (int i = 0; i < 5; i++)
{
puts(name[i]);
}
exit(0);
}