Category Archives: Pointer

Typedef Enum Union Project

code:

 

Another Good Example of Struct using Function and Pointer

code:

 

Using function with Struct user defined type also pointer

code:

why we used *sp in one place and sp in another place ?there s a reason behind this
*sp means address is passing where after the local input takeup it will go but if not use  dereferencing then it will not go outside. So to write we need with address.

and in sp it is read only. so to print sp is enough to show.

vid:

2d array dynamically with pointer/basics of 2d array

code:

with free:

vid:

 

Never Waste Your Memory, So use custom memory allocation with malloc() function and pointer to allocate memory dynamically, calloc(), realloc()

malloc() code:

calloc() code:

calloc vs malloc()

calloc initialized each byte with zero

realloc()
code:

 

theory vid:

Void Pointer and Typecasting in Pointer

code:

 

Char Pointer Practical Example Using String Input and String/Char Variable Passing

code:

Theory:

 

 

Send Array to Function Using Pointer

code:

 

Relationship Between 1D array and pointer

code:

theory:

Return More Than one Value in a Function

In function we can’t retun more than one value with return keyword. In this case we need pointer to return more variables than one in function.

code:

Ouput:

 

 

How and When to use Pointer in C programming

here in this code the swap function will not return the value as swapped but it’s working locally

code:

output:

 

so we need to work with address swapping and by sending address from the main function we are sending values using pointer in swap function

code:

output:

vid:

 

personally saying this vid cleared up my thoughts about pointer perfectly. Thanks to Shibaji 🙂

Char Pointer and Int Pointer

code:

 

Pointer More More Clear

Pointer Clear

code:

 

Pointer Good Basic

It will clear the confusion about the pointer when arises.

Sum clear:

example code:

Array and Pointer:

Array is nothing but a pointer:

another variable pointer example: