Advertisement
Md_hosen_zisad

POINTER DYNAMIC array input

Oct 31st, 2017
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. int main()
  4. {
  5.    int *ptr;
  6.    ptr=(int *)malloc(sizeof(int)*10);
  7.    printf("%X %d \n\n",ptr,sizeof(int));
  8.    int i;
  9.    for(i=0;i<5;i++)
  10.    {
  11.        scanf("%d",ptr+i);
  12.  
  13.    }
  14. for(i=0;i<5;i++)
  15.    {
  16.        printf("%X %d\n",(ptr+i),*(ptr+i));}
  17.        return 0;
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement