Pointer in C
×

Pointers in C

3552

The Pointer in C programming language is a variable that stores the address of other variables.

The pointer variable is such as int, float, char, double, short, etc.

Syntax:

data_type*var_name;

Example:

int*p; char*p;

Note: * denotes that p is the pointer variable, not a normal variable.


The example program for a pointer in the C is the following:

#include <stdio.h>
int main()
{
int*ptr, q;
q =80;
/* address of q is assigned to ptr */
ptr =&q;
/* display q's value using ptr variable */
printf("%d", *ptr);
return 0;
}

Result: 80



Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments