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
Hai what is the different types of versions and their differences
What is the argument of a function in c?
How can I get the current date or time of day in a c program?
Discuss the function of conditional operator, size of operator and comma operator with examples.
What are control structures? What are the different types?
Tell us the use of fflush() function in c language?
Write a program to maintain student’s record. Record should
not be available to any unauthorized user. There are three
(3) categories of users. Each user has its own type. It
depends upon user’s type that which kind of operations user
can perform. Their types and options are mentioned below:
1. Admin
(Search Record [by Reg. No or Name], View All Records,
Insert New Record, Modify Existing Record)
2. Super Admin
(Search Record [by Reg. No or Name], View All Records,
Insert New Record, Modify Existing Record, Delete Single Record)
3. Guest
(Search Record [by Reg. No or Name], View All Records)
When first time program runs, it asks to create accounts.
Each user type has only 1 account (which means that there
can be maximum 3 accounts). In account creation, following
options are required:
Login Name: <6-10 alphabets long, should be unique>
Password: <6-10 alphabets long, should not display
characters when user type>
Confirm Password:
How to draw the flowchart for structure programs?
What is the difference between variable declaration and variable definition in c?
What is f'n in math?
What should malloc(0) do?
Explain the difference between malloc() and calloc() in c?
What is malloc and calloc?
How many levels of pointers can you have?
What do you understand by normalization of pointers?