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...

Design a program using an array that searches a number if it
is found on the list of the given input numbers and locate
its exact location in the list.

Answer Posted / vignesh1988i

here i have used a concpt of pointers .. ie. array of
pointers.... when you search for a number it may occur once
or more than it... i have designed for all cases.. that's
why i used pointers......................

#include<stdio.h>
#include<conio.h>
void main()
{
int ch[100],m,n,*ptr[20],count=0;
printf("enter the limit value");
scanf("%d",&m);
for(int i=0;i<m;i++)
scanf("%d",&a[i]);
printf("enter the number u are searching for :");
scanf("%d",&n);
for(i=0,k=0;i<m;i++)
{
if(a[i]==m)
{
count++;
ptr[k]=&a[i];
k++;
}
for(i=0;i<count;i++)
printf("the number occured %d times and found to be int
these addresses : %u ",count,*(*(ptr+i)));
getch();
}

Is This Answer Correct ?    1 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is 1d array in c?

1029


Explain null pointer.

1041


develop algorithms to add polynomials (i) in one variable

2109


How do you use a pointer to a function?

1026


What is sizeof return in c?

983


What is scope rule in c?

1015


What is volatile c?

959


What are formal parameters?

1070


What the advantages of using Unions?

1164


Discuss the function of conditional operator, size of operator and comma operator with examples.

1098


What are local static variables?

1081


What are the types of variables in c?

979


in linking some of os executables are linking name some of them

2076


What is a void pointer in c?

1040


Is using exit() the same as using return?

1250