Print Value and Address of Using Pointer all Possible

-- Leave a Comment
Hello Here is a C program to Print address and values at variables
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include<stdio.h>
void main()
{
    int a, *b;
    b = &a;
    printf("Enter the value of A:- ");
    scanf("%d",b);
    printf("\n(Indirect) Address of A = %u.\n", b);
    printf("(Direct) Address of A = %u.\n", &a);
    printf("(Pointer) Value of A = %d.\n", *b);
    printf("(Direct) Value of A = %d.\n", a);
    printf("(address operator) Value of A = %u.\n", *(&a));
    printf("Address of B = %u.\n", &b);
    printf("Value of B = %u.\n", b);
    printf("Value of B = %u.\n", *(&b));
}

Run the Program and check the code.

Hello This is Sagar Devkota. Studying Bachelor of Software Engineering at Pokhara University. I know something about Linux, Android, Java, Nodejs, Unity3D and 3 dots :)

0 comments:

Post a Comment