Perform a task with calloc statement | C -Program

calloc(  ,  ) statement:

Code:

#include<stdio.h>

#include<stdlib.h>

void main()

{

    int *p,n,i;

    printf("Enter the size of array:\n");

    scanf("%d",&n);

    p=calloc(n,2);

    printf("Enter the array elements:\n");

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

        scanf("%d",p+i);

    printf("Elements are:\n");

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

        printf("%d\t",*(p+i));

}

Output:


Comments

Post a Comment

Give your feedback!
DO NOT SPAM !!
NO THIRD PARTY PROMOTIONAL LINK !!!! (else comment will be deleted.)

Popular posts from this blog

TOP 10 PROGRAMMING LANGAUAGES COMMING 2021 | ARTICLE

Print Fibonacci Series using Recursion | C program :