Pointers in C Programming

Pointers in C Programming

In this tutorial, we will study what are pointers in c programming, the advantage of using a pointer, the disadvantage of using pointers, operators using pointers, and a suitable example of pointers. So let’s go...

What are Pointers in C Programming

The pointers are variables that store the address of another variable. And every variable has a unique address in memory. These addresses are in hexadecimal form, so we cannot store these addresses in any normal variables, create a pointer variable to store the address of any variable. To declare which variable of pointer type, declare it with an asterisk (*) Symbol.

Syntax of its declaration: -

data_type *pointer_name;

To access the value of this variable by the address of the storage call of any variable, it is necessary to store the address of the storage call of this variable in another pointer-type variable. Because we cannot access any memory storage call without storing it in any variable.

Advantages of Using Pointers

  • Less time in program execution
  • Working on the original variable
  • With the help of pointers, we can create data structures (linked-list, stack, queue).
  • Returning more than one values from functions
  • Searching and sorting large data very easily
  • Dynamically memory allocation

Disadvantages of Using Pointers

  • Sometimes by creating pointers, such errors come in the program, which is very difficult to diagnose.
  • Sometimes pointer leaks in memory are also created.
  • If extra memory is not found then a program crash can also occur.

Operators Used with Pointers

1. & (Address-of ) operator:-

The & (Address-of) operator points to the address of the variable. From this, we can get the address of any variable.

2. * (Value-at) operator:-

The * (Value-at) operator only works with pointer variables. This operator represents the value stored at a particular address.

Example:-

#include<stdio.h>
int main()
{
  int rehanAge = 55;
  int *ptr;
  ptr = &rehanAge;
  /* address of rehanAge */
  printf(“Address of rehanAge: %dn”,ptr);
  /* value at rehanAge */
  printf(“Value of rehanAge: %d”,*ptr);
}

Output

Address of rehanAge: -1074204644
Value of rehanAge: 55

Originally posted on - Pointer in C Programming

To view or add a comment, sign in

More articles by Alimam Miya

  • Elevate Your CAT Preparation with iQuanta's CAT Online Course

    Are you preparing for CAT 2025 and looking for the best online course to boost your chances of success? iQuanta’s CAT…

  • Best CAT Score Calculator 2024

    The Common Admission Test (CAT) is a crucial milestone for MBA aspirants aiming for prestigious institutes like IIMs…

  • Top 10 Pharma Companies in India 2024

    In this will talk about the Top 10 Pharma Companies in India. India’s pharmaceutical assiduity has surfaced as a global…

  • Top 10 Credit Card Companies in India 2025

    This article will talk about the Top 10 Credit Card Companies in India. In the dynamic geography of India’s fiscal…

  • Top Real Estate Companies in India 2024

    This article will talk about the Top Real Estate Companies in India 2024. The real estate region in India has witnessed…

    1 Comment
  • Top Real Estate Companies in Kolkata 2024

    This article will talk about the Top Real Estate Companies in Kolkata. Kolkata, the artistic locus of India, is going…

  • Top Real Estate Companies in Delhi 2025

    This article will talk about the Top Real Estate Companies in Delhi. Delhi, the heart of India, not only serves as the…

    1 Comment
  • Hostinger Coupon Codes 2024 [60% Plan Discount]

    Looking for an affordable yet powerful hosting solution? Hostinger is one of the leading web hosting providers known…

  • 5 Best CAT Online Coaching in Gurugram

    Preparing for the Common Admission Test (CAT) can be a daunting task, especially with the myriad of coaching options…

  • CAT Mock Tests Series - Boost Your CAT Preparation

    Preparing for the Common Admission Test (CAT) can be a daunting task, but with the right resources and strategy, it can…

Insights from the community

Others also viewed

Explore topics