Example: Where : Prepared By: Dattu Kumar, Page - 1
Example: Where : Prepared By: Dattu Kumar, Page - 1
Disadvantages:
Using pointers sometimes be confusions.
A pointer variable should be define & initialized properly. Otherwise it leads to disastrous
situations.
Address of a variable:
In C language, the address of a variable ‘a’ is defined as: ‘&a’.
Here, the ampersand(&) symbol is called as reference (address) operator.
We have to assign this ‘&a’ (address of ‘a’) to the pointer variable as reference.
Initialization of Structures:
We can initialize (or) access the data members of a structure through structure variable using a
dot(.) operator.
Syntax: structure-variable.data_member = value;
Example: k.a=10;
printf(“a value is: %d”,k.a);
:: Declaring a Union ::
A union can be declared by using the keyword ‘union’
A ‘tag name’ is given to the union as union name.
Then define the variables of different data types as ‘data members’ of the union.
Finally we have to define a ‘union variable’ to access the data members of the union.
2. We use ‘struct’ keyword to define a structure. 2. . We use ‘union’ keyword to define a union.
*****