Here are few changes style wise, so may differ from person to person but be consistent.
- Add a comment at top of the file
- Add space after comma e.g. swap(int *,int *); -> swap(int *, int *);
- Add space after semicolon in for loop
- Add space after and before operators e.g '=', '+' , '-'
- Remove unecessary space after braces and main
- Be explicit so add braces {} in each for loop
- Group code lines in group and separate groups by newlines
- Start while loop brace from same column
Here is modified code
#include
#include
/********************************************
Write a comment about what this program does.
General overview
*********************************************/
void insert(int i);
void swap(int *, int *);
void heap_sort(int);
int a[20];
void main()
{
int n, i;
clrscr();
printf("Enter the no of elements : ");
scanf("%d", &n);
printf("\nEnter the elements : \n");
for(i=0; i0) && (item>a[j]))
{
a[i] = a[j];
i = j;
j = (i - 1) / 2;
}
a[i] = item;
}