-->

Initialization of the pointer variable

Initialization of the pointer variable
Initialization of the pointer variable
Pointer Definition and Declaration,Features of Pointers,Pointer Variables Declaration,Initialization of the pointer variable,difference between Pointers and Functions,Pointers and Functions,Dangling Memory in pointers,Pointer Arithmetic,Incrementing a Pointer,Decrementing a Pointer,Pointer comparisons,Pointer Arithmetic and Arrays,Pointer to Pointer,Arrays and Pointers,Pointer to Void,Memory Allocation Functions,Conceptual view of memory,Accessing Dynamic Memory,Memory Management functions,Block Memory Allocation – Malloc,Contiguous Memory Allocation – Calloc,Reallocation of Memory – Realloc,Releasing Memory,Introduction to Pointers,define pointer in c language,c programming pointers,what is pointer in c language,use of pointers,difference between arrays and pointers,role of pointer,pointers concept in c language,how to declare pointer variable in c,pointer declaration in c language,Overview of Pointers,cse study zone,real time examples for pointers,pointers examples
Pointer Definition and Declaration,Features of Pointers,Pointer Variables Declaration,Initialization of the pointer variable,difference between Pointers and Functions,Pointers and Functions,Dangling Memory in pointers,Pointer Arithmetic,Incrementing a Pointer,Decrementing a Pointer,Pointer comparisons,Pointer Arithmetic and Arrays,Pointer to Pointer,Arrays and Pointers,Pointer to Void,Memory Allocation Functions,Conceptual view of memory,Accessing Dynamic Memory,Memory Management functions,Block Memory Allocation – Malloc,Contiguous Memory Allocation – Calloc,Reallocation of Memory – Realloc,Releasing Memory,Introduction to Pointers,define pointer in c language,c programming pointers,what is pointer in c language,use of pointers,difference between arrays and pointers,role of pointer,pointers concept in c language,how to declare pointer variable in c,pointer declaration in c language,Overview of Pointers,cse study zone,real time examples for pointers,pointers examples


When two pointers are referencing with one variable, both pointers contain the address of the same variable, and the value changed through with one pointer will reflect to both of them.
To access the pointer variable: If the ‘*’ (asterisk sign) is before the pointer variable this means the pointer variable is now pointing to the value at the location instead of pointing to the location.

Example:
C program to find reverses of a number
#inlcude<stdio.h>
#include<conio.h>
void main()
{
int n,a;
int *rev, *rem, *temp;
printf(“Enter any number”);
scanf(“%d”,&n);
a=n;
temp=&n;
*rev=0;
/* place values of digits from n are reversed by cumulative multiplication by 10 
Starting from the least significant digit to the most */
while(*temp>0)
{
*rem = *temp%10;
*temp = *temp/10;
*rev =(*rev)*10 + *rem;
}
printf(“Reverse of %d”is %d”, a, *rev);
}

OUTPUT
Enter any number: 123
Reverse of 123 is 321

Related Posts

Subscribe Our Newsletter