|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h>
#include <stdlib.h>
void sort(int *n, int n1);
int main()
{
int a[5] = {1, 2, 3, 4, 5};
int i, q = 5;
sort(a, 5);
for(i = 0; i < q; ++i)
{
printf("%d ", a[i]);
}
return 0;
}
void sort(int *n, int n1)
{
int i, j;
for(i = n1; i > 0; --i)
{
for(j = 0; j < n1; ++j)
{
if(n[j] > n[j + 1])
{
*temp = *n[j];
*n[j] = *n[j + 1];
*n[j + 1] = *temp;
}
}
}
}
D:\我的文档\My Codeblocks\sort3\main.c||In function 'sort':|
D:\我的文档\My Codeblocks\sort3\main.c|27|error: 'temp' undeclared (first use in this function)|
D:\我的文档\My Codeblocks\sort3\main.c|27|note: each undeclared identifier is reported only once for each function it appears in|
D:\我的文档\My Codeblocks\sort3\main.c|27|error: invalid type argument of unary '*' (have 'int')|
D:\我的文档\My Codeblocks\sort3\main.c|28|error: invalid type argument of unary '*' (have 'int')|
D:\我的文档\My Codeblocks\sort3\main.c|28|error: invalid type argument of unary '*' (have 'int')|
D:\我的文档\My Codeblocks\sort3\main.c|29|error: invalid type argument of unary '*' (have 'int')|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 0 seconds) ===|
|
|