100% prog to show that pointer can point to different memory locations at different points of time

// Online C compiler to run C program online
#include <stdio.h>

int main()
{
 int *ptr,i=4, j=9;
 ptr=&i;//pointer is pointing to i
 printf("\n initial address to which the pointer is pointing =%u",ptr);
 printf("\n initial value to which the pointer is pointing =%d",*ptr);
 ptr=&j;
 printf("\n finally, the address to which the pointer is pointing =%u",ptr);
 printf("\n finally, the value to which the pointer is pointing =%d",*ptr);
 return 0;
}
తెరమీద 


initial address to which the pointer is pointing =3436051748
 initial value to which the pointer is pointing =4
 finally, the address to which the pointer is pointing =3436051744
 finally, the value to which the pointer is pointing =9




కామెంట్‌లు

ఈ బ్లాగ్ నుండి ప్రసిద్ధ పోస్ట్‌లు

100% C prog to write content into a file and then read it back onto the console

Spic macay

శ్రీరస్తు.. రామలింగ 18-1-24 (సూరసాని వారి ఆహ్వానము)