C Online Compiler
Example: Sum of Two Numbers in C using Pointers
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// Sum of Two Numbers in C using Pointers #include <stdio.h> int main() { int p, q, r; int *a, *b; printf("Enter two integer values::\n"); scanf("%d %d", &p, &q); // To get the address of `p` and `q` variable a = &p; b = &q; // calculating sum r = *a + *b; printf("Result:: %d + %d = %d\n", *a, *b, r); return 0; }
34 54
Output
Clear
ADVERTISEMENTS