Advertisement
inhuman_Arif

Max with pointer

Oct 12th, 2021
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.24 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int max(int *a,int *b)
  4. {
  5.     int mx;
  6.     if(*a>*b)
  7.         mx= *a;
  8.     else
  9.         mx= *b;
  10.     return mx;
  11. }
  12.  
  13. int main()
  14. {
  15.     int a,b;
  16.     scanf("%d %d",&a,&b);
  17.     printf("%d\n",max(&a,&b));
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement