0
Why this returning only -1?
1 Respuesta
+ 2
for(int i=0;i<=n;i++){ // not include index n;
scanf("%d",&arr[i]);
}
int key;
scanf (" enter value%d",&key); // this is inccirect way :
Use instead :
for(int i=0;i<n;i++){
scanf("%d",&arr[i]);
}
int key;
printf("Enter value for key : "); // if you want to display message :
scanf("%d",&key);