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

Is c is a low level language?

1153


Why C language is a procedural language?

1051


Can two or more operators such as and be combined in a single line of program code?

1380


Explain how does flowchart help in writing a program?

1130


Explain the advantages of using macro in c language?

1010


What is the difference between struct and typedef struct in c?

1134


What does nil mean in c?

1286


explain what is a newline escape sequence?

1101


Why is it usually a bad idea to use gets()? Suggest a workaround.

1804


What is the difference between #include

and #include “header file”?

1039


Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

1178


What is far pointer in c?

1322


What does c mean?

1064


Why is it that not all header files are declared in every C program?

1235


What is #define in c?

1057