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


Please Help Members By Posting Answers For Below Questions

What are the complete rules for header file searching?

677


How do I determine whether a character is numeric, alphabetic, and so on?

623


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

658


What is a char in c?

557


Can we declare variable anywhere in c?

538






How can you find out how much memory is available?

618


How do we open a binary file in Read/Write mode in C?

681


Explain the difference between the local variable and global variable in c?

605


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

667


What is static identifier?

704


What does emoji p mean?

606


What is exit() function?

561


When the macros gets expanded?

791


i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

1844


How can I copy just a portion of a string?

818