Abb*_*ndi 0 c arrays return-type incompatibletypeerror function-declaration
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
float array(float a[],int n);
int main() {
int k=5;
float a[k+1];
array(a[k+1],k);
}
float array(float a[],int n )// n = size of array
{
printf("enter elements in order of increasing:\n");
for(int i=0;i<n;i++) {
printf("array[%d]:",i);
scanf("%f",&a[i]);
}
return a;
}
Run Code Online (Sandbox Code Playgroud)
我想构建一个程序来使用函数给出一个浮点数递增的数组,但它有一个错误,编译器显示这些错误:
[Error] cannot convert 'float*' to 'float' in return9
[Error] cannot convert 'float' to 'float*' for argument '1' to 'float array(float*, int)'
Run Code Online (Sandbox Code Playgroud)