m writin a code that will take data frm stdin from user which can b of indefinte size..
but i cant make use of static arrays....and even calloc and malloc is not working properly...what sud i do???
Your program doesn't work because it is destroying the ch1 pointer on each loop iteration. You can't increment ch1, just leave it along after the initial allocation with malloc(). Use a different pointer or integer.
Another problem is that your program is very very slooooow -- malloc() and realloc() are rather time consuming, so instead of allocating just one character at at time you should allocate a block of characters, then when the block is filled up you should call realloc() to increase the block