write a function that accepts an integer/char array and an
search item.If the search item is there in the array return
position of array and value else return -1.without using
other array,without sorting,not to use more than one loop?
Answer Posted / nikhil srivastav (mca pesit b
int search(int *arr,int item,int arr_size)
{
int i;
for(i=0;i<arr_size;i++)
{
if(item==*(arr+i))
return i;
}
return -1;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
while initialization of array why we use a[][2] why not a[2][]...?
What is the difference between union and anonymous union?
What are the 3 types of structures?
What Is The Difference Between Null And Void Pointer?
What math functions are available for integers? For floating point?
how can I convert a string to a number?
Explain the difference between #include "..." And #include <...> In c?
What is restrict keyword in c?
What are preprocessor directives in c?
What is nested structure in c?
What is return type in c?
What is pointer and structure in c?
What are the different types of objects used in c?
The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration
State two uses of pointers in C?