Pointer is a derived datatype in C and pointer variable is a special variable that holds the memory address or location of another variable(i.e. it point to another variable). Referencing a value through a pointer is called indirection or dereferencing.
Declaration of pointer variable:-
A pointer variable is declared with an (*) operator before the variable name and is known as pointer or indirection or dereference operator.
Syntax:-
data-type *pointer_variable_name;
e.g:-
int *ptr;
Initialization:-
Every pointer variable contain garbage value before assignment of some valid address. So, pointer variable must be assigned with '0' or some valid address.
Output:-
a=10
a=10
Below are some important C program using pointer:-
> Call by Value and Call by reference
> C program to input 'n' number in an array and display it using pointer.
> C program to input 'n' number in an array and find the sum of all elements using pointer.
> C program to input 'n' number in an array and find highest and lowest element using pointer.
> C program to input 'n' number in an array and print in reverse order using pointer.
> C program to input 'n' number in an array and find sum of odd and even elements and count using pointer.
> C program to input 'n' number in an array and determine the sum of first and second largest number using pointer.
> C program to input 'n' number in an array and check whether the given number is present in an array or not using pointer.
> C program to input 'n' number in array and sort them using pointer.
> C program to input 3*3 order matrix and display it using pointer.
> C program to input m*n order matrix and display it using pointer.
> C program to input m*n order matrix and find the sum of all element using pointer.
> C program to input m*n order matrix and find sum of main diagonal element using pointer.
> C program to input any string and display it using pointer.
> C program to count no. of vowel in a given paragraph using pointer.
> C program to convert given character to upper case if it is lower case and vice versa using function and pointer.
> C program to input any string and display it using function and pointer.
> C program using pointer to recieve a sorted array of integer value and insert the value in correct place
Some other important C programs:-
Important C program of 1D Array
Important C program of Matrix(2D Array)
Important C program of string
Important C program using Function
Important C program using Recursive function
Click Here to download complete notes of C programming.
Declaration of pointer variable:-
A pointer variable is declared with an (*) operator before the variable name and is known as pointer or indirection or dereference operator.
Syntax:-
data-type *pointer_variable_name;
e.g:-
int *ptr;
Initialization:-
Every pointer variable contain garbage value before assignment of some valid address. So, pointer variable must be assigned with '0' or some valid address.
void main()
{
int a=10;
int *ptr;
ptr= &a;
printf("a= %d",a);
printf("a=%d",*ptr);
}
{
int a=10;
int *ptr;
ptr= &a;
printf("a= %d",a);
printf("a=%d",*ptr);
}
Output:-
a=10
a=10
Below are some important C program using pointer:-
> Call by Value and Call by reference
> C program to input 'n' number in an array and display it using pointer.
> C program to input 'n' number in an array and find the sum of all elements using pointer.
> C program to input 'n' number in an array and find highest and lowest element using pointer.
> C program to input 'n' number in an array and print in reverse order using pointer.
> C program to input 'n' number in an array and find sum of odd and even elements and count using pointer.
> C program to input 'n' number in an array and determine the sum of first and second largest number using pointer.
> C program to input 'n' number in an array and check whether the given number is present in an array or not using pointer.
> C program to input 'n' number in array and sort them using pointer.
> C program to input 3*3 order matrix and display it using pointer.
> C program to input m*n order matrix and display it using pointer.
> C program to input m*n order matrix and find the sum of all element using pointer.
> C program to input m*n order matrix and find sum of main diagonal element using pointer.
> C program to input any string and display it using pointer.
> C program to count no. of vowel in a given paragraph using pointer.
> C program to convert given character to upper case if it is lower case and vice versa using function and pointer.
> C program to input any string and display it using function and pointer.
> C program using pointer to recieve a sorted array of integer value and insert the value in correct place
Some other important C programs:-
Important C program of 1D Array
Important C program of Matrix(2D Array)
Important C program of string
Important C program using Function
Important C program using Recursive function
Click Here to download complete notes of C programming.
Comments
Post a Comment