Example: array is as below
struct grp_cdng new_grp[] =
{
{6,0},
{6,3},
{8,1},
{8,3},
{13,2}
};
key is set to 8 so search_me is returning (8,1), I don't know which position this element is there(3rd) in the array?
I should not go each element in the array(0 to 5) to compare...
I didn't understad how to get the position of the key in the array after it is returning pointer from bsearch.
I didn't want go each eliment in the array to compare the values returned from bsearch pointer.
Sharath.
Thanks Salem,
I have a situation where my array is having following values
struct grp_cdng new_grp[] =
{
{6,0},
{6,3},
{8,1},
{9,3},
{13,2}
};
when my key is 6, I would like to know following things:
1. The program should return 2(count) when I'm searching array with key value...
Hi All,
Please find the program where I'm passing key value '6' for searching in array of structures but it is returning 'The number is in the array cdng::8 grp_idx::1' as output. Can somebody please let me know what I'm doing wrong?
------------------------------------
#include <stdio.h>...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.