Pointers In C

What are Pointers in C

It is a variable which is used to store the address of another variable in other words you can ay it points to the address of the variable. pointers improve the performance of the program also helps to reduce the code and can accessed to any memory location , Pointers can be used with array, functions and structures .

Example pointer

[php]#include<stdio.h>
#include<conio.h>
void main()
{
int a=70 ;
int *p; // pinter declaration;
p=&amp;amp;a;//store the address of a
printf("%x",p);// address of pointer
getch();
}[/php]

Output

fff4

 

Pointers concept and description

Sr.No. Concept & Description
1

Pointer arithmetic

There are four arithmetic operators that can be used in pointers: ++, –, +, –

2

Array of pointers

You can define arrays to hold a number of pointers.

3

Pointer to pointer

C allows you to have pointer on a pointer and so on.

4

Passing pointers to functions in C

Passing an argument by reference or by address enable the passed argument to be changed in the calling function by the called function.

5

Return pointer from functions in C

C allows a function to return a pointer to the local variable, static variable, and dynamically allocated memory as well.

Hits: 243

Tags: No tags

Share your thoughts