这是我编写的程序中的主要函数,我需要对字符数组进行排序,使这些字符在开头具有偶数 ascii 代码,并且我想显示数组在每次迭代时的排序方式。
\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\n\n int main ()\n { \n int n, i,j;\n char echange;\n printf("array size : ");\n scanf("%d", &n);\n char t[n];\n for (i=0; i<n; i++)\n {\n printf("enter array elements : ");\n scanf(" %c", &t[i]);\n }\n\n \n\n for (j=0; j<n; j++)\n for (i=0; i<n; i++)\n {\n if ((t[i] % 2!=0) && (t[i+1] % 2 ==0) && (i != n-1))\n {\n strcpy(echange, t[i]);\n strcpy(t[i], t[i+1]);\n strcpy(t[i+1], echange);\n printf (" %c (%d)", t[i], t[i]);\n }\n else\n printf(" %c (%d)", &t[i], t[i]);\n\n …Run Code Online (Sandbox Code Playgroud)