i fail to call values of structure variable in another function

This is a discussion on i fail to call values of structure variable in another function within the C Programming forums, part of the General Programming Boards category; Hi, I fail to call the values of a structure variable in the function OpenBoard and there it goes into ...

  1. #1
    Registered User mrprogrmr's Avatar
    Join Date
    Dec 2004
    Posts
    9

    i fail to call values of structure variable in another function

    Hi,

    I fail to call the values of a structure variable in the function OpenBoard and there it goes into starvation.

    Could you help me how do i assign the given values .
    I clear my point here with the following lines of code.

    TBoardParam BoardParam;

    1. TBoardParam is a structure with the variable BoardParam.
    2. The BoardParam is assigned some values in the function UpdateBoardParams()
    3. The function OpenBoard is then called which Opens the Board with BoardId and as according to
    BoarParam values. But i find the problem here.

    When i debug, i see the values of BoardParams in UdateBoardParams(),
    i.e pBoardParam->TrunkConfig[0].ProtocolType =PROTOCOL_TYPE_E1_EXTRA_30;
    But when the control again is passed to OpenBoard() it shows the error like
    CXX0030: Error: expression cannot be evaluated

    /**************************************************/
    /* trFunction: OpenBoard(). */
    /* Does all the necessary work to open the board. */
    /*The function returns the BoardHanlde after it has beenopened*/
    /* successfully. */
    /************************************************** */

    acTBoardHandle OpenBoard()
    {

    TBoardParam BoardParam;
    // TBoardParam is a structure type
    UpdateBoardParams(&BoardParam);
    // Thevalues to the structure variable BoardParam is assigned here
    BoardId = 0;
    BoardHandle = OpenBoard(BoardId,&BoardParam);
    // OpenBoard is a function that takes 2 parameters
    // 1. BoardId 2. BoardParam values
    }
    void UpdateBoardParams( TBoardParam * pBoardParam)
    {
    pBoardParam->TrunkConfig[0].ProtocolType =PROTOCOL_TYPE_E1_EXTRA_30;
    pBoardParam->TrunkConfig[0].TraceLevel =FULL_ISDN_TRACE;
    pBoardParam->TrunkConfig[0].DChConfig =DCH_CONFIG_BACKUP;
    pBoardParam->TrunkConfig[0].LineBuildOut.XPM0=0;
    }


    --------------------------------------------------------------------------------

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,485
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  2. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 12:03 PM
  4. Replies: 10
    Last Post: 09-27-2005, 12:49 PM
  5. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21