·

# Introduction

In this article, I will further explain the concept of pointers (data structure) with some examples to practice what we have mentioned in the last article(part 1). To understand this concept you should check first the article Parte one and welcome back to train with me.

## Example number 1:

We assume that we have a class of 50 students and each person is defined by:

1. His code,
2. His family name [ max = 20 character];
3. His name [ max = 20 character];

### Calculate the memory space using the two methodes for a class of 20 students

1. Method One : (2+20+20)*50 =2100 bytes

Since we use here static variables, So if we need to calculate the memory area for one student is always equal to the storage space for 50 students, so the result will be always 2100 bytes

While the second method, the mechanism is different

S= 50+(2+20+20)*20 = 8900 bytes

Since we use here pointers we consume just the requested memory size, 50: Is the size of the pointer array, since they announced that each pointer occupies one byte

### For Method number 1 (Using Static Variables) :

Waste and mismanagement of data since static variables occupy memory until the end of execution.

### For Method number 2 :

Better optimization of memory space since dynamic variables can be created and deleted at any time

# Comparison between pointers:

the C language allows us to compare pointers using

== , != ,< ,>,<=,>= , null

# Point -an-array

We suppose T is an array of integers and P is a pointer to an integer

# Conclusion

These are the most popular instructions that you will need to use pointers and to build a solid basis in this domain I hope that you found my article useful, I did my best to clarify the idea and present it in a simple way