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
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
How can I manipulate individual bits?
Why pointers are used in c?
Explain what is the difference between far and near ?
How do shell structures work?
What is the default value of local and global variables in c?
Write a program to reverse a given number in c?
What is the newline escape sequence?
What are the 5 elements of structure?
a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.
What is pragma in c?
Is it fine to write void main () or main () in c?
What is the difference between struct and typedef struct in c?
What is anagram in c?
What is printf () in c?