Type Here to Get Search Results !

Operations on Individual Members

Operations on Individual Members

The individual members are identified using the member operator, the dot(.).
A member with the dot operator along with its structure variable can be treated like any other variable name and therefore can be manipulated using expressions and operators.
We can also apply increment and decrement operators to numeric type members.
Example: The following example statements are valid:
studentlenumber++;
++studentl.number;

 The precedence of the member operator is higher than all arithmetic and relational operators and therefore no parenthesis is required.

Two ways to access members:
struct employee {
int eno;
float salary;
} e1;
struct employee *p; // declaring a pointer of type struct.employee
p = &e1;

The identifier "p" is known as a pointer that has been assigned the address of the structure variable e1.

Now the members can be accessed in two ways
using dot notation: e1.eno
using indirect selection notation: p -> eno

C Programming Operations on Individual Members

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Top Post Ad

Below Post Ad