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));
}
you are working well...
ReplyDelete