like the title suggests i need help completing my first code. i got all of it working but my linear search. i cant seem to find the syntax to plug in the struct array into the second perameter.
i used this prototype
int lin_search( int target, int array[], int n );
this structure
struct account{
int accountNum;
int balance;
};
int main( void ){
struct account accInfo[4];
i tryed to use this pointer syntax
struct accInfo (*mypointer)[4];
but it doesnt seem to be the right one
index = lin_search( accN, mypointer.balance, 4);
the actual search is working just cant get the second perameter to match up
int lin_search( int target, int array[ ], int n ){
int i;
for ( i = 0; i < n; i++)
{
if ( array[ i ] == target )
return i;
}
return -1;
}
some one plz help this is really frustrating.
Full code on my other post.
i used this prototype
int lin_search( int target, int array[], int n );
this structure
struct account{
int accountNum;
int balance;
};
int main( void ){
struct account accInfo[4];
i tryed to use this pointer syntax
struct accInfo (*mypointer)[4];
but it doesnt seem to be the right one
index = lin_search( accN, mypointer.balance, 4);
the actual search is working just cant get the second perameter to match up
int lin_search( int target, int array[ ], int n ){
int i;
for ( i = 0; i < n; i++)
{
if ( array[ i ] == target )
return i;
}
return -1;
}
some one plz help this is really frustrating.
Full code on my other post.
Last edited: