My issue
sol.c: In function ‘main’:
sol.c:12:12: error: expected ‘(’ before ‘array’
12 | if array[i] == x {
| ^~~~~
| (
sol.c:22:5: error: ‘retuen’ undeclared (first use in this function)
22 | retuen 0;
| ^~~~~~
sol.c:22:5: note: each undeclared identifier is reported only once for each function it appears in
sol.c:22:11: error: expected ‘;’ before numeric constant
22 | retuen 0;
| ^~
| ;
Run
Sub
My code
#include <stdio.h>
int main() {
int n, x;
scanf("%d %d", & n, & x);
int array[n];
for (int i = 0; i < n; i++) {
scanf("%d", & array[i]);
}
int found = 0;
for (int i = 0; i < n; i++) {
if array[i] == x {
founf = 1;
break;
}
}
if (found) {
printf("yes\n");
} else {
printf("no\n");
}
retuen 0;
}
Learning course: Data structures & Algorithms lab
Problem Link: https://www.codechef.com/learn/course/muj-dsa-c/MUJDSAC19/problems/SESO03