Advertisement
DrAungWinHtut

pointer.c

Jul 9th, 2023
860
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include<stdio.h>
  2. void addi(int* ii); //int i = 44;
  3. float area(float a, float b);
  4. int main()
  5. {
  6.     int i = 0;
  7.     int* iptr = &i; //star with datatype => pointer creation   
  8.     *iptr = 44;
  9.     printf("before adding i = %d and its address is %x \n", i, &i);
  10.     addi(&i);
  11.     printf("after adding i = %d and its address is %x \n", i,&i);
  12.  
  13.      float g = area(12.5, 22.6);
  14.  
  15.     return 0;
  16. }
  17.  
  18. void addi(int *k) //int * k = &i;
  19. {
  20.     *k = *k + 22;
  21. }
  22.  
  23. float area(float a, float b)
  24. {
  25.     float area = a * b;
  26.     return area;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement