#include stdio.h
#include conio.h
void main(){
int *p_num; //define a pointer which holds the integer value
int num;
p_num = # // assign a value(address) to a pointer
printf("enter number : ");
scanf("%d",&num);
printf("the integer number assigned to variable num is: num = ");
printf("%d\n\n",num);
printf("the address integer variable num is stored: &num = ");
printf("%d\n\n",&num);
printf("the value stored in the pointer p_num is: p_num = ");
printf("%d\n\n",p_num);
printf("the address of pointer is in the memory is: &p_num = ");
printf("%d\n\n",&p_num);
printf("the value which address is stored in the pointer is:*p_num = ");
printf("%d\n\n",*p_num);
getch();//to hold the display
}//end of main
Output
1.we have to assign a address to the pointer not a value
2."&"(ampersand) sign is used to get the address of the variable stored in the memory
3."*"(atrisk) is used to declare the pointer and to get the value from pointer
No comments:
Post a Comment