Best C Programming code for representing Dynamic Memory Allocation using calloc()(February,2021)

#include<stdio.h>

int main()
{
    int *p,m,i;//

    printf("Enter the number of elements : ");
    scanf("%d",&m);
    p=(int *)calloc(m,sizeof(int));
    

    printf("Enter the values : ");

    for(i=0;i<m;i++)
    {
        scanf("%d",(p+i));//(0x90 + 0) /// (0x90 + 1)
    }
    printf("Values are : ");
    for(i=0;i<m;i++)
    {
        printf("%d,",*(p+i));
    }
}

Leave a Reply