Answers for "find a value in an array c"

C
0

search array element in c

#include <stdio.h>

int main()
{
    int ara[10]={1,2,3,4,5,6,7,8,9,10};
    int i,is_found=-1,search_value;
    printf("Enter search value:\n");
    scanf("%d",&search_value);
    for(i=0;i<10;i++){
        if(ara[i]==search_value){
            is_found=i;
        }
    }
    
    if(is_found==-1){
        printf("Item not found\n");
        
    }else{
        printf("Item found at index on. %d\n",is_found);
    }

    return 0;
}
Posted by: Guest on July-13-2021
-1

how to find the elements in array c coding

#include <stdio.h>
int main(){
	int mark[] = {12,34,56,23,21};
//	 printf("%d",mark[0]);
	int size= sizeof mark/ sizeof mark[4];
	printf("%d",size);
	return 0; 
}
Posted by: Guest on September-08-2021

Code answers related to "find a value in an array c"

Code answers related to "C"

Browse Popular Code Answers by Language