0

Why this C Language programme returning nothing ?

#include <stdio.h> #include <stdlib.h> int findElement() { int a[]={4,7,5,12,18,11}; int key=4; int i; for( i=0;i<6;i++) { if(a[i]==key) { return 1; } } return -1; } void main () { findElement(); }

12th May 2020, 3:31 PM
rajendra
rajendra - avatar
2 Réponses
+ 2
rajendra because you are not printing anything. Do this. int a = findElement(); printf("%d", a); Second this main should be return something so it will be int main()
12th May 2020, 3:33 PM
A͢J
A͢J - avatar