Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

while initialization of array why we use a[][2] why not a[2][]...?

2358


What is the difference between union and anonymous union?

1302


What are the 3 types of structures?

1029


What Is The Difference Between Null And Void Pointer?

1248


What math functions are available for integers? For floating point?

1131


how can I convert a string to a number?

1082


Explain the difference between #include "..." And #include <...> In c?

1025


What is restrict keyword in c?

1105


What are preprocessor directives in c?

1094


What is nested structure in c?

1060


What is return type in c?

1131


What is pointer and structure in c?

1172


What are the different types of objects used in c?

1026


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

1098


State two uses of pointers in C?

1055