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
Is c is a low level language?
Why C language is a procedural language?
Can two or more operators such as and be combined in a single line of program code?
Explain how does flowchart help in writing a program?
Explain the advantages of using macro in c language?
What is the difference between struct and typedef struct in c?
What does nil mean in c?
explain what is a newline escape sequence?
Why is it usually a bad idea to use gets()? Suggest a workaround.
What is the difference between #include
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
What is far pointer in c?
What does c mean?
Why is it that not all header files are declared in every C program?
What is #define in c?