top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Can structures be passed to the functions by value? If yes, how?

+5 votes
358 views
Can structures be passed to the functions by value? If yes, how?
posted Dec 24, 2013 by Prachi Agarwal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

yes we can.
The whole structure is passed to another function by value. It means the whole structure is passed to another function with all members and their values. So,structure can be accessed from called function.

struct student
{
int id;
char name[20];
float percentage;
};

void func(struct student record);

int main()
{
struct student record;

        record.id=1;
        strcpy(record.name, "Raju");
        record.percentage = 86.5;

        func(record);
        return 0;

}

void func(struct student record)
{
printf(" Id is: %d \n", record.id);
printf(" Name is: %s \n", record.name);
printf(" Percentage is: %f \n", record.percentage);
}

Output:
Id is: 1
Name is: Raju
Percentage is: 86.500000

answer Jan 2, 2014 by Sandeep
Similar Questions
+3 votes

Suppose I have two eNBs, configured as S1 intra-frequency neighbours and my UE is attached to one of them. There is no X2 connection present between them.
Now, I have done admin down to the source eNB. So, HO process is triggered. As a consequence of this, source eNB sends HO required message to MME.

My query is, in this HO required message, what should be the value of ac-BarringFactor??
Should it be P00 or the last value set before admin down(e.g., P95)?

...