0% found this document useful (0 votes)
7 views19 pages

Module - Iv: Pointers

This document provides an introduction to pointers in C programming, explaining their declaration, initialization, and usage, including referencing and dereferencing operators. It covers pointer arithmetic, arrays of pointers, and differences between variables and pointers, as well as the concept of pointer-to-pointer (double pointer). Additionally, it introduces structures in C, illustrating how to define and declare them for managing complex data types.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views19 pages

Module - Iv: Pointers

This document provides an introduction to pointers in C programming, explaining their declaration, initialization, and usage, including referencing and dereferencing operators. It covers pointer arithmetic, arrays of pointers, and differences between variables and pointers, as well as the concept of pointer-to-pointer (double pointer). Additionally, it introduces structures in C, illustrating how to define and declare them for managing complex data types.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

INTRODUCTION TO PROGRAMMING I B.

TECH I SEM (R23)

MODULE – IV
Pointers
The pointer in C language is a variable which stores the address of another variable.
This variable can be of type int, char, array, function, or any other pointer. The size of the
pointer depends on the architecture. However, in 32-bit architecture the size of a pointer is 2
byte.
Declaration and Initialization of Pointer:-
data_type *pointer_variable_name;
Ex:- int *p1; int *p2;
Consider the following example to define a pointer which stores the address of an
integer.
int n = 10;
int* p = &n; // Variable p of type pointer is pointing to the address of the variable n of
type integer. (& is called as ampersand, * is called as asterisk)

Pointer Example:
Let Ptr is a pointer variable that contains the address of another variable Q. then Ptr is
said to be pointing to Q. If the address of Q is 642230 then the value of Ptr would be 642230.
Using this address, we can manipulate the value of Q. It can be as shown below:

Pointer variable Ptr Q Variable of type int


Value of Ptr 642230 10 Value of Q
Address of Ptr 6422296 642230 Address of Q
Example Program:
#include <stdio.h>
void main()
{
int Q = 10;
int *Ptr;
Ptr = &Q;
printf("Value of Q = %d \n", Q);
printf("Address of Q = %u \n", &Q);
printf("Value of Ptr = %u \n", Ptr);
printf("Address of Ptr = %u \n", &Ptr);
printf("Value of the pointer pointing = %d", *Ptr);
}
Output:
Value of Q = 10
Address of Q = 6422300
Value of Ptr = 6422300
Address of Ptr = 6422296
Value of the pointer pointing = 10

1
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

Referencing and Dereferencing Operators


‘C’ language provides two special operators to manipulate the data items directly
from memory location using pointer variables.
1. Referencing Operator or Address Operator (&)
2. Dereferencing Operator (*)
1. Referencing or Address Operator (&): The address operator is used to get and assign
the address of a variable to a pointer variable.
Ex: ptr = &x;
Where ‘ptr’ is a pointer variable which holds the address of the variable ‘x’. So ‘ptr’
is a pointer to ‘x’ that points to the location of ‘x’ as shown below:
Points
Address of x Value of x
to
ptr x
2. Dereferencing Operator (*): The asterisk (*) character is used as dereferencing
operator. It is a unary operator that returns the value located at the address.
Ex: x =*ptr;
This statement assigns the value stored at address ‘ptr’ into the variable ‘x’ Hence
*ptr can also be assumed as *(&ptr) is equal to ptr.
Example – 1:
#include <stdio.h>
int main()
{
int x = 9;
int *ptr;
ptr = &x;
*ptr = 8;
printf("value of x is : %d", x);
return 0;
}
Output:
value of x is : 8

Example – 2:
// Swap Two Numbers using pointer
#include <stdio.h>
void main()
{
int a, b, *p, *q, temp;
p = &a;
q = &b;
printf("Enter two numbers \n");
scanf("%d%d", &a, &b);
printf("Before swapping: %d %d \n", a, b);
temp = *p;
*p = *q;

2
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

*q = temp;
printf("After Swapping %d %d \n", *p, *q);
}
Output:
Enter two numbers
10 20
Before swapping: 10 20
After Swapping 20 10

Pointer Arithmetic
Pointer Arithmetic is the set of valid arithmetic operations that can be performed on
pointers These operations are:
1. Increment of a Pointer ( ++ )
2. Decrement of a Pointer ( -- )
3. Addition of integer to a pointer (+)
4. Subtraction of integer to a pointer (-)
5. Comparison of pointers ( > and <)

Increment of a Pointer:
It means increment a pointer by the pointer with start pointing to the immediate exist
locaton.
Example:
int n = 10;
int *ptr;
ptr = &n;
ptr++; // ptr = ptr + 1;
Pointer incremented by 1 and now start pointing to the immediate next location.
new – address = current – address + i * sizeof(data_type)

Pointer variable ptr n Variable of type int


Value of ptr 65524 10 Value of n
Address of ptr 6422296 65524 Address of n
= 65524 + 1 * sizeof(int)
= 65526 (after update)

Decrement of a Pointer:
It means decrement a pointer by 1 the pointer will start pointing to the immediate
previous location.
Example:
int n = 10;
int * ptr;
ptr = &n;
ptr--; // ptr = ptr - 1;
Pointer decremented by 1 and now start pointing to the immediate previous location.

3
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

new – address = current – address - i * sizeof(data_type)

Pointer variable ptr n Variable of type int


Value of ptr 65524 10 Value of n
Address of ptr 6422296 65524 Address of n
= 65524 - 1 * sizeof(int)
= 65522 (after update)

Addition of Integer to Pointer:


When a pointer is added with an integer value, the value is first multiplied by the size
of the data type and then added to the pointer.
Example:
int n = 10;
int * ptr;
ptr = &n;
ptr = ptr + 3; // Adding 3 to pointer variable
new – address = current – address + i * sizeof(data_type)

Pointer variable ptr n Variable of type int


Value of ptr 65524 10 Value of n
Address of ptr 6422296 65524 Address of n
= 65524 + 3 * sizeof(int)
= 65530 (after update)

Subtraction of Integer to Pointer:


When a pointer is subtracted with an integer value, the value is first multiplied by the
size of the data type and then subtracted from the pointer similar to addition.
Example:
int n = 10;
int * ptr;
ptr = &n;
ptr = ptr - 3; // Subtract 3 to pointer variable.
new – address = current – address - i * sizeof(data_type)

Pointer variable ptr n Variable of type int


Value of ptr 65524 10 Value of n
Address of ptr 6422296 65524 Address of n
= 65524 - 3 * sizeof(int)
= 65518 (after update)

Comparison of Pointers:
We can compare the two pointers by using the comparison operators ( > and <). It
returns true for the valid condition and returns false for the in-valid condition.

4
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

Example:
int *p1, *p2, x, y;
p1 = &x;
p2 = &y;
Note: p1 < p2 and p1 > p2 are valid operations.
//Pointer Arithmetic Example Program
#include <stdio.h>
void main()
{
int n1 = 10, n2 = 12;
int *ptr1, *ptr2;
ptr1 = &n1;
ptr2 = &n2;
printf("ptr1 = %d \n", ptr1);
ptr1++;
printf("Increment = %d \n", ptr1);
ptr1--;
printf("Decrement = %d \n", ptr1);
printf("Addition = %d \n", ptr1+3);
printf("Subtraction = %d \n", ptr1-3);
printf("ptr1 = %u - ptr2 = %u \n", ptr1, ptr2);
printf("Comparision = %u \n", ptr1 > ptr2);
}

Output:
ptr1 = 6422292
Increment = 6422296
Decrement = 6422292
Addition = 6422304
Subtraction = 6422280
ptr1 = 6422292 - ptr2 = 6422288
Comparision = 1
Array of Pointers
An array of pointers in C is used when we need to point to multiple variables or
memory locations of the same data type
Syntax:
data_type *name_of_array [array_size];
Example:1 To represent array of pointers
#include <stdio.h>
void main()
{
int arr[5] = {45, 65, 85, 35, 78};
int i;

5
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

int *ptr;
for (i = 0; i < 5; i++)
{
ptr = &arr[i];
printf("Adress of Array[%d] = %u \n", i, ptr);
ptr++;
}
}

Output:
Adress of Array[0] = 6422276
Adress of Array[1] = 6422280
Adress of Array[2] = 6422284
Adress of Array[3] = 6422288
Adress of Array[4] = 6422292

Write a program to print sum of array elements using pointer.


#include <stdio.h>
void main()
{
int arr[5]; // Declare an array of integers
int *ptr; // Declare an integer pointer
int sum = 0; // Initialize sum
int i;
// Input array elements
printf("Enter 5 elements of the array : ");
for (i = 0; i < 5; i++)
{
scanf("%d", &arr[i]);
}
// Use the pointer to traverse and compute the sum
ptr = arr; // Point to the first element of the array
for (i = 0; i < 5; i++)
{
sum += *ptr; // Add the value pointed by ptr to sum
ptr++; // Move the pointer to the next array element
}
// Display the result
printf("Sum of array elements: %d\n", sum);
}

Output:
Enter 5 elements of the array : 10 20 30 40 50
Sum of array elements: 150

6
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

Differences between Variables and Pointers


VARIABLE POINTER
Pointer is a variable that holds address of
Variable is capable to hold ordinary values.
another variable.
The general form of an ordinary variable The general form of a pointer variable
declaration is : declaration is :
Syntax: Datatype Identifier; Syntax: Datatype *PtrVaribale;
Example: int x; Example: int*ptr;
The general form of initializing a pointer
The general form of initializing a variable is:
variable is:
Syntax: Variable = Value;
Syntax: PtrVariable = &Variable;
Example: int x;
Example: int x,*p;
x = 10;
p = &x;
For ordinary variables compiler allocates For any type pointer variables compiler
memory based on their datatypes. allocates only 2 bytes of memory.
Example: int x; Example: int *p;
For ‘x’, compiler allocates 2 Bytes. For ‘p’, compiler allocates 2 Bytes.
For ordinary variables only static memory For pointer variables dynamic memory
allocation is possible. allocation is possible.
/* Example program for Variables */ /* Example program for Pointer */
#include <stdio.h> #include <stdio.h>
void main() void main()
{ {
int x = 10; int x = 10, *p = &x;
printf("Result = %d \n", x); printf("Result = %d", *p);
} }
Output: Output:
Result = 10 Result = 10

Pointer to Pointer (Double Pointer) or Multiple Indirection

A pointer-to-pointer (double pointer) is used to store the address of another pointer.


The first pointer stores the address of a variable, and the second pointer stores the address of
the first pointer. This makes them useful for changing the values of normal pointers
Declaration of Pointer to a Pointer
The declaration of a pointer to pointer (double pointer) is similar to the declaration of
a pointer, the only difference is that you need to use an additional asterisk (*) before the
pointer variable name.
Example:
The following declaration declares a "pointer to a pointer" of type int.
int **var;
When a target value is indirectly pointed to by a "pointer to a pointer", accessing that
value requires that the asterisk operator be applied twice.

7
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

Example of Pointer to Pointer (Double Pointer)


#include <stdio.h>
void main()
{
int x = 10;
int *a;
int **b;
a = &x;
b = &a;
printf("Address of x = %u \n", &x);
printf("Address of x = %u \n", a);
printf("Address of pointer a = %u \n", &a);
printf("Address of pointer a = %u \n", b);
printf("Address of pointer b = %u \n", &b);
}

Output:
Address of x = 6422300
Address of x = 6422300
Address of pointer a = 6422296
Address of pointer a = 6422296
Address of pointer b = 6422292

Need of Structure
Assume that we are going to develop a software for the college library to manage all
students information. Student information includes roll number, name, age, date of birth, and
address.
Example,

Need to store Example Data type


Roll number 501 integer
Name "Hari" string
Age 20 Integer
Date of birth "01-01-2006" String
Address "1, New Street, etc" String
Fine 100.50 Float

Structure
Structure in c is a user-defined data type that enables us to store the collection of
different data types. Each element of a structure is called a member. The, struct keyword is
used to define the structure.

8
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

Syntax to Define the Structure


struct structure_name
{
data_type member1;
data_type member2;

data_type memeberN;
};
Let's see the example to define a structure for an entity employee in c.
struct employee
{
int id;
char name[50];
float salary;
};
Here, struct is the keyword, employee is the tag name of structure; id, name and
salary are the members or fields of the structure. Let's understand it by the diagram given
below:

Declaring structure variable


We can declare a variable for the structure so that we can access the member of the
structure easily. There are two ways to declare structure variable:
1. By struct keyword within main() function
2. By declaring a variable at the time of defining the structure.

9
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

struct keyword within main():


Let's see the example to declare the structure variable by struct keyword. It should be
declared within the main function.
struct employee
{
int id;
char name[50];
float salary;
};
Now write given code inside the main() function.
struct employee e1,e2;

Example Program:
#include <stdio.h>
struct employee
{
int id;
char name[50];
float sal;
};
void main()
{
struct employee e1,e2;
printf("Enter employee-1 Id, Name, Salary: ");
scanf("%d %s %f", &e1.id, &e1.name, &e1.sal);
printf("Enter employee-2 Id, Name, Salary: ");
scanf("%d %s %f", &e2.id, &e2.name, &e2.sal);
printf("Id \t Name \t Salary \n");
printf("%d \t %s \t %.2f \n", e1.id, e1.name, e1.sal);
printf("%d \t %s \t %.2f \n", e2.id, e2.name, e2.sal);
}
Output:
Enter employee-1 Id, Name, Salary: 5502 Ravi 54634
Enter employee-2 Id, Name, Salary: 5512 Giri 54323
Id Name Salary
5502 Ravi 54634.00
5512 Giri 54323.00

Declaring a variable at the time of defining the structure:

Let's see another way to declare variable at the time of defining structure.
struct employee
{
int id;
char name[50];
float salary;
} e1, e2;

10
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

Example Program:
#include <stdio.h>
struct employee
{
int id;
char name[50];
float sal;
} e1, e2;
void main()
{
//struct employee e1,e2;
printf("Enter employee-1 Id, Name, Salary: ");
scanf("%d %s %f", &e1.id, &e1.name, &e1.sal);
printf("Enter employee-2 Id, Name, Salary: ");
scanf("%d %s %f", &e2.id, &e2.name, &e2.sal);
printf("Id \t Name \t Salary \n");
printf("%d \t %s \t %.2f \n", e1.id, e1.name, e1.sal);
printf("%d \t %s \t %.2f \n", e2.id, e2.name, e2.sal);
}
Output:
Enter employee-1 Id, Name, Salary: 5502 Ravi 54634
Enter employee-2 Id, Name, Salary: 5512 Giri 54323
Id Name Salary
5502 Ravi 54634.00
5512 Giri 54323.00

Accessing Structure Members


There are two operators used to access structure members:
1. Dot Operator (.)
2. Arrow Operator (->)
Dot Operator (.):
The dot operator (.) is used to access members of a structure variable.
Example 1:
#include <stdio.h>
#include <string.h>
struct Employee
{
int id;
char name[20];
};

int main()
{
struct Employee emp;
emp.id = 101;
strcpy(emp.name, "Hari");

11
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

printf("ID: %d, Name: %s\n", emp.id, emp.name);


return 0;
}
Output:
ID: 101, Name: Hari

Example 2:
#include <stdio.h>
struct Employee
{
int id;
char name[20];
};

int main()
{
struct Employee emp[2] = {{101, "Hari"}, {102, "Ravi"}};
printf("ID: %d, Name: %s\n", emp[0].id, emp[0].name);
printf("ID: %d, Name: %s\n", emp[1].id, emp[1].name);
return 0;
}
Output:
ID: 101, Name: Hari
ID: 102, Name: Ravi

Arrow Operator (->)


Arrow operator (->) is used to access members of a structure pointer.
#include <stdio.h>
struct Employee
{
int id;
char name[20];
};

int main()
{
struct Employee emp = {101, "Hari"};
struct Employee *ptr = &emp;
printf("ID: %d, Name: %s\n", ptr->id, ptr->name);
return 0;
}
Output:
ID: 101, Name: Hari

Example 2:
#include <stdio.h>
struct Employee {

12
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

int id;
char name[20];
};

int main() {
struct Employee emp[2] = {{101, "Hari"}, {102, "Ravi"}};
struct Employee *ptr[2] = {&emp[0], &emp[1]};
printf("ID: %d, Name: %s\n", ptr[0]->id, ptr[0]->name);
printf("ID: %d, Name: %s\n", ptr[1]->id, ptr[1]->name);
return 0;
}
Output:
ID: 101, Name: Hari
ID: 102, Name: Ravi

Nesting of Structures
Nesting structures involves defining one structure inside another. This allows for
complex data organization and representation.
 Define the inner structure (Address) before the outer structure (Employee).
 Declare an instance of the inner structure (address) within the outer structure.
 Access nested members using the dot operator (.).

Benefits of Nesting Structures


 Improved data organization
 Better representation of complex relationships
 Enhanced code readability
Syntax:
struct OuterStructure
{
member1;
member2;
struct InnerStructure
{
member3;
member4;
} innerVariable;
};

Example Program:
#include <stdio.h>
// Inner structure
struct Address
{
char street[20];
char city[20];
int zip;
};

13
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

// Outer structure with nested inner structure


struct Employee
{
int id;
char name[20];
struct Address address;
};

int main()
{
// Initialize employee structure
struct Employee emp = { 101, "Hari", {"123 Main St", "Nellore",
524001}};

// Access and print employee details


printf("ID: %d\n", emp.id);
printf("Name: %s\n", emp.name);
printf("Address: %s, %s %d\n", emp.address.street, emp.address.city,
emp.address.zip);
return 0;
}

Output:
ID: 101
Name: Hari
Address: 123 Main St, Nellore 524001

Array of Structures
An array of structures can be defined as the collection of multiple structures variables
where each variable contains information about different entities. The array of structures is
used to store information about multiple entities of different data types. The array of
structures is also known as the collection of structures.

Declaration of Array of Structures


struct structure_name array_name [number_of_elements];

14
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

Initialization of Array of Structures


We can initialize the array of structures in the following ways:
struct structure_name array_name [number_of_elements] = {
{element1_value1, element1_value2, ....},
{element2_value1, element2_value2, ....},
......
......
};

Example Program:
#include <stdio.h>
#include <string.h>
struct student
{
int rollno;
char name[10];
};
int main()
{
int i;
struct student st[5];
printf("Enter Records of 5 students \n");
for (i = 0; i < 5; i++)
{
printf("Enter Rollno:");
scanf("%d", &st[i].rollno);
printf("Enter Name:");
scanf("%s", &st[i].name);
}
printf("\nStudent Information List:");
printf("\nRollno \t Name \t");
for (i = 0; i < 5; i++)
{
printf("\n%d \t %s", st[i].rollno, st[i].name);
}
return 0;
}

Output:
Enter Records of 5 students
Enter Rollno:501
Enter Name:Hari
Enter Rollno:502
Enter Name:Giri
Enter Rollno:503
Enter Name:Ravi

15
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

Enter Rollno:504
Enter Name:Sita
Enter Rollno:505
Enter Name:Gita

Student Information List:


Rollno Name
501 Hari
502 Giri
503 Ravi
504 Sita
505 Gita

Self-Referential Structure
A self-referential structure is a structure that contains a pointer to itself, either directly
or indirectly. This allows for dynamic data structures such as linked lists, trees, and graphs.
Syntax:

The above syntax, data1 and data2 are stores the node's value. The link is a pointer to
the next node in the linked list.
Example:
struct node
{
int data1;
char data2;
struct node *link;
};

int main()
{
struct node ob;
return 0;
}

Types of Self Referential Structures


1. Self Referential Structure with Single Link
2. Self Referential Structure with Multiple Links

16
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

Self Referential Structure with Single Link:


These structures can have only one self-pointer as their member. The following example
will show us how to connect the objects of a self-referential structure with the single link and
access the corresponding data members. The connection formed is shown in the following
figure.

Self Referential Structure with Multiple Links:


Self referential structures with multiple links can have more than one self-pointers.
Many complicated data structures can be easily constructed using these structures. Such
structures can easily connect to more than one nodes at a time. The following example
shows one such structure with more than one links.

Unions
Unions are conceptually similar to structures. The syntax of union is also similar to
that of structure. The only difference is in terms of storage. In structure each member has its
own storage location, whereas all members of union use a single shared memory location
which is equal to the size of its largest data member.
 Memory Efficiency
 Flexible Data Storage
 Compiler Design
 Embedded Systems
 Network Protocols
 Data Compression

17
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

Declaration:
union union_name
{
data_type member1;
data_type member2;
.
.
data_type memeberN;
};
Initializatioin:
union union_name union_variable = {value1, value2, ……..};

Example:
union employee
{
int id;
char name[50];
float salary;
};

Example Program:
#include <stdio.h>
#include <string.h>
union Data
{
int i;
float f;
char str[20];
};
int main()
{
union Data data;
data.i = 10; // Store integer
data.f = 20.5; // Store float
strcpy(data.str, "Hello"); // Store string
printf("Integer: %d\n", data.i);
printf("Float: %f\n", data.f);

18
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur
INTRODUCTION TO PROGRAMMING I B.TECH I SEM (R23)

printf("String: %s\n", data.str);


return 0;
}
Output:
Integer: 1819043144
Float: 1143139122437582500000000000.000000
String: Hello
Difference between Structure and Union

S.No Structure Union


For defining structure use struct
1 For defining union we use union keyword
keyword.
Structure occupies more memory
2 Union occupies less memory space than Structure.
space than union.
In Structure we can access allIn union we can access only one member of union at
3
members of structure at a time.
a time.
Union allocates one common storage space for its all
Structure allocates separate
members. Union find which member need more
4 storage space for its every
memory than other member, then it allocate that
members.
much space
Example to demonstrate the difference between unions and structures:
#include <stdio.h>
union un_e
{
char name[32];
float f;
int i;
} u;
struct st_e
{
char name[32];
float f;
int i;
} s;

void main()
{
printf("Size of union = %u bytes \n", sizeof(u));
printf("Size of structure = %u bytes \n", sizeof(s));
}

Output:
Size of union = 32 bytes
Size of structure = 40 bytes

~ ~ END OF THE UNIT ~ ~

19
P. Srihari, Assistant Professor, Narayana Engineering College, Gudur

You might also like