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 / p govind rao
#include<stdlib.h>
#include<stdio.h>
#define Max 6
int fun_rev(int *ptr, int num)
{
int i=0;
while(i<=Max)
{
if(num==*ptr)
{
return 1 ;
}
else
{
return 0;
}
i++;
ptr++;
}
}
int main()
{
int arr[Max]={3,4,5,6,2,1};
int item=6,result;
result=fun_rev(arr,item);
printf("result = %d",result);
return 0;
}
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Write a program to find factorial of a number using recursive function.
What does do in c?
Explain what is the difference between functions abs() and fabs()?
Sir i need notes for structure,functions,pointers in c language can you help me please
What is difference between far and near pointers?
What are the rules for the identifier?
What is stack in c?
What are the 5 data types?
What is a lookup table in c?
Why doesnt the call scanf work?
How can you return multiple values from a function?
How many types of errors are there in c language? Explain
What is #include stdio h and #include conio h?
What is volatile c?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list