help completing my first code

Discussion in 'C Programming' started by noob_code, Oct 18, 2009.

  1. noob_code

    noob_code

    Joined:
    Oct 17, 2009
    Messages:
    3
    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: Oct 18, 2009
    noob_code, Oct 18, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. strotee76
    Replies:
    9
    Views:
    10,983
    Brian M. Dean
    May 8, 2005
  2. Ali Servet Dönmez
    Replies:
    16
    Views:
    511
    Ali Servet Dönmez
    Jul 6, 2008
  3. Ivan Ven Osdel
    Replies:
    1
    Views:
    342
    Ali Servet Dönmez
    Jul 2, 2008
  4. Ivan Ven Osdel
    Replies:
    1
    Views:
    351
    Ali Servet Dönmez
    Jul 3, 2008
  5. Python Nutter
    Replies:
    1
    Views:
    329
    Ali Servet Dönmez
    Jul 6, 2008
Loading...

Share This Page