All pastes #576444 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-06-19 14:16 UTC
rendered paste body
/****                   A program to understand Dynamic memory Allocation
*******
***                                  By +Nullset
*****
****
****/


#include <stdio.h>

/* Main function starts here */
int main()
{
    int n, i;
    int *p;
    
    
    printf("Enter the number of elements");
    scanf("%d", &n);
    
    p = (int *)malloc(n*sizeof(int));
    
    if(p == NULL) {
       printf("Insufficient Memory\n");
    }
    
    else    
       for(i=0;i<n;i++){
          printf("Enter the Number : ");
          scanf("%d", p+i);
       }
    
   
    
    for(i=0;i<n;i++)
       printf("%d", *(p+i));
       
    fgetc(stdin);
    return 0;
}
/* Main function ends here */