fork download
  1. bool search(int value, int values[], int n)
  2. {
  3. // TODO: implement a searching algorithm
  4.  
  5. for (int i = 0; i != n; i++)
  6. {
  7. if (values[i] == value)
  8. {
  9. return true;
  10. }
  11. else
  12. {
  13. return false;
  14. }
  15. }
  16.  
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:1: error: unknown type name 'bool'
 bool search(int value, int values[], int n)
 ^
prog.c: In function 'search':
prog.c:9:20: error: 'true' undeclared (first use in this function)
             return true;
                    ^
prog.c:9:20: note: each undeclared identifier is reported only once for each function it appears in
prog.c:13:20: error: 'false' undeclared (first use in this function)
             return false;
                    ^
prog.c:17:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
stdout
Standard output is empty