#include<stdio.h>
#include<stdlib.h>
void main()
{
int *a,*b;
int x,y,i;
printf("Please enter the size of array");
scanf("%d",&x);
a=(int*)malloc(x*sizeof(int));
printf("\n Enter %d values in array",x);
for(i=0;i<x;i++)
{
scanf("%d",(a+i));
}
printf("\nValue in the array is");
for(i=0;i<x;i++)
{
printf("%d ",*(a+i));
}
free(a);
}
output
#include<stdlib.h>
void main()
{
int *a,*b;
int x,y,i;
printf("Please enter the size of array");
scanf("%d",&x);
a=(int*)malloc(x*sizeof(int));
printf("\n Enter %d values in array",x);
for(i=0;i<x;i++)
{
scanf("%d",(a+i));
}
printf("\nValue in the array is");
for(i=0;i<x;i++)
{
printf("%d ",*(a+i));
}
free(a);
}
output
No comments:
Post a Comment