inhuman_Arif

Printing with pointer

Oct 12th, 2021
648
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int n;
  7.     scanf("%d",&n);
  8.     int *arr = (int*)malloc(n*sizeof(int));
  9.     int i;
  10.     for(i=0;i<n;i++)
  11.         scanf("%d",arr+i);
  12.     for(i=0;i<n;i++)
  13.         printf("%d ",*(arr+i));
  14.  
  15.     return 0;
  16. }
RAW Paste Data