#include <stdio.h>
int sum(int a[6], int n, int key);
int sum(int a[6], int n, int key) {
int ret=0;
for(int i = 0; i < 6; i++){
if(a[i] <= key){
return ret += a[i];
}
}
}
int main() {
int result = 0;
int a[6] = {35, 24, 49, 16, 58, 12};
result = sum(a[6], 5, 39);
}
5 5 [Note] expected 'int *' but argument is of type 'int'
18 15 [Warning] passing argument 1 of 'sum' makes pointer from integer without a cast
빡머가리라 잘 모름
sum함수인자를 배열로 받아서 그럼