When allocating Strings on the heap (with 'malloc'),
and initializing them with the standard input (using 'fgets),
an unnecessary newline appears between them when trying to print them (with 'printf' and %s formatting).
for example:
main()
{
char *heap1;
char *heap2;
heap1=malloc(10);
heap2=malloc(10);
fgets(heap1,10,stdin);
fgets(heap2,10,stdin);
printf("%s%s",heap1,heap2);
}
with input "hi1\nhi2" produces "hi1\nhi2". compiled using gcc 4.3.4 for Debian.