Hi,
I've not worked in C, C++ from like 5-6 years.
But now I got to do a very small change (explained below).
I tried reading tutorials but only got confused.

Below I've struct containing 2 attributes.
I need to create its refrence and pass values to these 2 attributtes.

File in which struct is defined.

//List of includes

typedef struct dscvs {
    UPD_TRC(trc_no);
    UPD_STS(status);
}dscvs_i;

File in which struct variable is used
// Here I need to create a variable of type dscvs_i, so that I can feed the values inside UPD_TRC(trc_no) & UPD_STS(status);
// This is what I'm doing

dscvs_i *i_updsc;
i_updsc->trc_no = trcno;

But this is throwing error "error: expression must be a modifiable lvalue"

Please suggest.

Hi,

I think the structure defination is wrong; It should be like

` //asumng UPD_TRC and UPD_STS is user defined data type.`

    typedef struct dscvs {
        UPD_TRC trc_no;
        UPD_STS status;
    }dscvs_i;

    dscvs_i *i_updsc;

    // point i_updsc to some memory location before using it.
    i_updsc=new dscvs_i;
    i_updsc->trc_no = trcno;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.