0% found this document useful (0 votes)
4 views5 pages

Pointer in C: Presented by Rana Das (B.Tech Cse) EN NO.A2345921028

A pointer in C is a variable that stores the address of another variable and is used for dynamic memory allocation. Pointers must be declared with a specific data type and initialized with the address of a variable of the same type using the address operator '&'. An example program demonstrates pointer declaration, initialization, and how to access the value of a variable using a pointer.

Uploaded by

therana295
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Pointer in C: Presented by Rana Das (B.Tech Cse) EN NO.A2345921028

A pointer in C is a variable that stores the address of another variable and is used for dynamic memory allocation. Pointers must be declared with a specific data type and initialized with the address of a variable of the same type using the address operator '&'. An example program demonstrates pointer declaration, initialization, and how to access the value of a variable using a pointer.

Uploaded by

therana295
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

POINTER IN

C
PRESENTED BY
RANA DAS[B.TECH CSE]
EN NO.A2345921028
POINTER

• Pointer is a variable that stores the address of another variable. A pointer


in c is used to allocate memory dynamically at run time. The pointer
variable might be belonging to any of the data type such as int, float,
char, double, short etc.

Pointer syntax:
data_type*var_name;
Example:
int*p; char*p;
DECLARING POINTER VARIABLE

• Pointers variables contain addresses that belong to a separate


data type, they must be declared as pointers before we use
them. The declaration of a pointer variable takes the following

data_type*pt_name;
INITIALIZATION OF POINTER
VARIABLE

Pointer initialization is the process of assigning address of a variable to pointer


variable. Pointer variable contains address of variable of same data type. In C
address operator & is used to determined the address of a variable. The & address
of the variable.
EXAMPLE:
int a = 10 ;
int*ptr, //pointer declaration
ptr=&a; //pointer initialization
or
Int*ptr=&a; //initialization and declaration together
EXAMPLE PROGRAM

#include<stdio.h>
Int main()
Output:
{
Int *ptr, q; //declaration 50
q=50;
ptr = &q; //initialization
printf(“%d”, *ptr); //display q’s value using ptr variable
printf(“%d”, *ptr);
return 0
}

You might also like