deepan said:
Hai everybody!
I've recently joined this group.Really amazed at the activity of this
group!
Please somebody could suggest me a c code to search for the no. in a
given array of no.s without using scanf( ) and printf( ).
scanf() is used for input,
printf() is used for output.
Neither input nor output is necessary for your task.
We normally refuse to supply answers to what appear to be homework
problems, but
a) A homework problem would probably not have the spurious mention
of scanf and printf, and
b) if this _is_ a homework problem, you probably need to modify
the following so it does not shout to the instructor, "This is
not my work!", and
c) the following might not be doing exactly what you want, anyway.
/* The following function returns a pointer to the sought integer, or
a null pointer if not found */
int * find_the_number( size_t cnt /* # of elements in the array */,
int the_array[],
int the_number)
{
size_t i;
for (i = 0; i < cnt; i++)
if (the_number == the_array
) return &the_array;
return 0;
}