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;
}
#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
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
కామెంట్లు
కామెంట్ను పోస్ట్ చేయండి
దయచేసి మీ సలహాలను సూచనలను స్పష్టంగా పేర్కొనగలరు. plz see that ur comments are 'acceptable' in a value based society.