How to initialize Pointer Variable
Program to create, initialize and use pointer variable
/**
* C program to create, initialize and use pointers
*/
#include <stdio.h>
int main()
{
int num = 10;
int * ptr;
/* Stores the address of num to pointer type */
ptr = #
printf("Address of num = %d\n", &num);
printf("Value of num = %d\n", num);
printf("Address of ptr = %d\n", &ptr);
printf("Value of ptr = %d\n", ptr);
printf("Value pointed by ptr = %d\n", *ptr);
return 0;
}
Output
Happy coding 😉
Comments
Post a Comment