#include<stdio.h>
#include<stdlib.h>
void main()
{
int *tab,i,n;
clrscr();
printf("Enter size of table:");
scanf("%d",&n);
tab = (int *)malloc(n*sizeof(int));
printf("Enter elements of tables:\n");
for(i=0;i<n;i++)
{
printf("[%d]=",i);
scanf("%d",&tab[i]);
}
printf("Index\tValue\n");
for(i=0;i<n;i++)
{
printf("%d\t%d\n",i,tab[i]);
}
free(tab);
tab = NULL;
printf("Table erased successfully.\n");
}
Output:
Enter size of table: 3
Enter elements of tables:
[0]=12
[1]=23
[2]=34
Index Value
0 12
1 23
2 34
Table erased successfully.
/