Write a program to implement the basic functionalities of pointers in C. A pointer in C is a way to share a memory address among different contexts (primarily functions).
Example:
Input: a = 4, b = 5
Output: 9 , 1
C Program
#include <stdio.h>#include <math.h>void update(int *a, int *b){int c, d;c = *a + *b;d = fabs(*a - *b);printf("%d\n%d", c, d);}int main(){int a = 4, b = 5;int *pa = &a, *pb = &b;update(pa, pb);return 0;}
No comments:
Post a Comment