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

which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;

3159


How can I manipulate individual bits?

984


Why pointers are used in c?

946


Explain what is the difference between far and near ?

1048


How do shell structures work?

1069


What is the default value of local and global variables in c?

983


Write a program to reverse a given number in c?

981


What is the newline escape sequence?

1020


What are the 5 elements of structure?

1041


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.

5001


What is pragma in c?

1130


Is it fine to write void main () or main () in c?

965


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

1083


What is anagram in c?

874


What is printf () in c?

1013