Programming in C—"POINTERS".

Hello Everyone

images.jpeg

Image Source

I hope you all are fine and safe inside your homes. This is a weird time ongoing in the whole world and I hope it will get over soon. As during this time, everyone is locked into their homes. I want to share the C programming language with you. I hope you guys like it, so let's happen today's topic.

POINTERS

Pointers in C are straightforward and fun to be told. Some C programming tasks are performed more simply with pointers, and alternative tasks, like dynamic memory allocation, cannot be performed while not exploitation pointers. thus it becomes necessary to be told tips that would become a perfect C engineer. Let's begin learning them in straightforward and easy steps.
As you acknowledge, each variable could also be a memory location and every memory location has its address outlined which could be accessed exploitation punctuation & operator, that denotes an address in memory. contemplate the following example, that prints the address of the variables defined—

#include <stdio.h>
int main () {
 int var1;
 char var2[10];
 printf("Address of var1 variable: %x\n", &var1 );
 printf("Address of var2 variable: %x\n", &var2 );
 return 0;

After the execution of the above code, it will provide this result—

Address of var1 variable: bff5a400
Address of var2 variable: bff5a3f6
What is a Pointer?

A pointer could also be a variable whose price is that the address of another variable, i.e.,direct address of the memory location. like each variable or constant, you wish to declare a pointer before exploitation it to store any variable address. the ultimate form of a pointer variable declaration is —

type *var-name;

Here, kind is that the pointer's base kind; it should be a legitimate C knowledge type and var-name is that the name of the pointer variable. The asterisk * used to declare a pointer is that a similar asterisk used for multiplication. However, throughout this statement the asterisk is obtaining used
to designate a variable as a pointer. Take a look at variety of the valid pointer declarations—

int *ip; /* pointer to an integer */
double *dp; /* pointer to a double */
float *fp; /* pointer to a float */
char *ch /* pointer to a character */

The actual knowledge kind of the value of all pointers, whether or not whole number, float, character, or otherwise, is that a similar, a extended hex variety that represents a memory address.
The only distinction between pointers of varied knowledge sorts is that the info kind of the
variable or constant that the pointer points to.

Logo.png


Gif by @doze

Logo.png

Thank you.

I hope you guys liked my post.

Keep Supporting.

STAY TUNED FOR NEXT POST

UPVOTECOMMENTRESTEEM
IF YOULIKEDMY POST

Logo.png

Created by @zord189

Stay Home, Stay Safe

@peerzadazeeshan

PEACE✌️✌️