P181. Program to allocate dynamic memory to 5 integers, scan it and print it

 

#include<stdio.h>

#include<stdlib.h>

void main()

{

        int *p,i;

        p=malloc(sizeof(int)*5);

        printf("Enter the integer : ");

 

        for(i=0;i<5;i++)

        scanf("%d",&p[i]);

 

        for(i=0;i<5;i++)

        printf("%d\n",p[i]);

}

Comments