#include<stdio.h>
#include<conio.h>
#include<alloc.h>
int * makearray(int );
void readdata(int *,int );
void printdata(int *,int );
void main()
{
int *a,num;
clrscr();
printf("enter the size of array\n");
scanf("%d",&num);
a=makearray(num);
readdata(temp,num);
printdata(a,num);
getch();
}
int * makearray(int n)
{
int *temp;
temp=(int *)malloc(sizeof(int)*n);
printf("address of temp is %x and value of temp is %d and first value of temp is garbage i.e %d\n",&temp,temp,*temp);
return temp;
}
void readdata(int *x,int n)
{
for(n--; n>=0; n--)
{
printf("enter the value in cell[%d]\n",n);
scanf("%d",x+n);
} …
Run Code Online (Sandbox Code Playgroud)