- Use spaces and new lines. Without them code in any style is hardly readable. Also avoid a wall of text style.
Look at this:
void main ()
{
int n, i;
clrscr ();
printf ("Enter the no of elements : ");
scanf ("%d", &n);
printf ("\nEnter the elements : \n");
for (i = 0; i < n; i++)
scanf ("%d", &a[i]);
heap_sort (n);
printf ("\nSorted array is : \n");
for (i = 0; i < n; i++)
printf ("\t%d", a[i]);
getch ();
}
It's better now, isn't it?
Avoid meaningless one-letter variable names. They are cryptic and convey no information to the reader (and to yourself six months later).
Add comments where necessary. If you see some part of code may not be clear on its own, comment it. If you use some hack or trick, describe it, what is it and why you need it. If you use some algorithm (especially for mathematical calculations), reference it.
Avoid very long functions bodies. If you see a function is getting too much stuff, refactor it. Extract common and repetitive pieces into shared and helper functions, so that a person reading your code can see the overview of the function.
Avoid magic numbers in your code. Don't put some abstract numbers (3, 17, 135 etc.) directly in your code. Declare constants somewhere and reference them in your code. This way it will only take on change to have consistent effect in your code. It's easy to forget to change... well, say, 3 out of 26 number uses in the code.
The same goes for text strings. Declare them somewhere, in resources, in external files, as string constants and use them in the code.