help completing my first code

Joined
Oct 17, 2009
Messages
3
Reaction score
0
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.
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top