
指针与数组
小菜的奋斗史
这个作者很懒,什么都没留下…
展开
-
三种方式(二维数组,指针数组,数组指针)输入10个字符串,进行排序,输出
方式一 二维数组#include <stdio.h>#include <string.h>/*输入10个字符串,进行排序,输出* 利用字符型二维数组*/#define N 10// 选择排序void sort(char p[][20]){ int i = 0, k, j = 0;char temp[20];原创 2019-03-09 17:36:16 · 9731 阅读 · 0 评论 -
用指向指针的指针的方法对5个字符串排序输出
#include <stdio.h>#include <string.h>#define LineSize 20void sort(char **s, int n) // 冒泡排序{int i, j;char temp[LineSize];for(i = 1; i < n; i++) for(j = 0; j < n-i; j++) {...原创 2019-03-10 12:18:06 · 726 阅读 · 0 评论 -
用指向指针的方法对输入的 n 个整数排序输出
#include <stdio.h>/*用指向指针的方法对输入的 n 个整数排序输出*/void sort(int **p, int n){int i,j, *temp;for(i = 1; i < n; i++) for(j = 0; j < n-i; j++) { if(**(p+j) > **(p+j+1)) // 值比较 ...原创 2019-03-10 14:11:24 · 926 阅读 · 0 评论