Indeed, main returns an int, stdin shouldn't be flushed, and yes, indent your code better. But don't forget to tell us the error. We're helping you as it is, you can at least do us a favor and not require us to compile your code.

Well there are many errors. Void main is among them. There are also many errors that are caused depending on how you're compiling this (under what standard). Other errors are reported in some compilers but not others.

Well for starters, if you actually plan on changing what the pointer points to when you pass it to a function, you need to be passing a pointer to a pointer instead. Otherwise when the function ends, your realloc is in effect thrown out the window.