Thread: i fail to call values of structure variable in another function

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

    i fail to call values of structure variable in another function


    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
    // 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;


  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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.

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, 01: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