A pointer in C programming is a type of variable designed for storing addresses. If you have already covered the basics of C or any other programming language, you should know about the regular variables and their purpose. Basically, variables are names that are assigned to some location in memory. These names usually contain values.
In this C pointers tutorial, we will be taking a look at pointers, their meaning and use. Therefore, the students of this course should be familiar with the basics of the C language. However, this course is beginner-friendly in terms of people that have never heard of pointers and want to start using them.
Pointers are a little different from regular variables. Instead of storing values, pointers hold addresses. By definition, pointers point to the address of a different variable. Just like an integer, it holds numbers that are interpreted as the address of another object. A pointer in C programming is one of the main ingredients for allocating memory dynamically. The latter concept refers to the memory allocation at runtime.
In this C pointers tutorial, I will be teaching you about the single, double, and triple pointers that you can use. I will show the process of defining them in your code. The concept of a double pointer in C programming refers to a pointer to pointer. In other words, it means that instead of pointing to a standard variable with data, we are pointing to another pointer.
Therefore, the first pointer then stores the address of a certain variable, and the second pointer holds the address of the first pointer.
This pattern is one of the possibilities of how to use pointers in C. Additionally, you can consider triple pointers. The latter concept means that you direct one pointer to a different pointer, and that pointer points to a different pointer. Sounds confusing? I will be presenting you with visual representations of these relationship models and give you useful code examples as well.
In this C pointer tutorial, I will provide you with some material that you can download for the course. Then, we go straight to the business of learning about a pointer in C programming. I will discuss its use and how it is related to dynamic memory allocation. Furthermore, I will go into detail about the single, double, and triple pointers and how to use pointers in C.
In one of the sections of this C pointer tutorial, I will explain the meaning of LValue and RValue. In brief, LValue refers to the value of the variable address (where is it stored). The RValue represents the contents of the address that LValue indicates.
Additionally, I will explain the side effects of mismatches. What does that mean? This mistake occurs when programmers mismatch the type of the pointer and type of the underlying data. In this course, you will find out why the data type needs to be the same for a pointer in C programming to work properly.