Additional new line due to char pointer

how is line 19 able to move the cursor, on the o/p console, to the next line

code link: https://ide.codingblocks.com/s/613041

Hi @s.kumar
So line 19 is basically not printing anything… so next is being printed over there…

line 19 is printing character ‘A’, but I’m wondering why is it giving new line when I have not given endl

bro line 19 is not doing anything… check it carefully

image
like just write this additional print in that line 19… when u run this u get to know only hello is being printed… thus it is evident that nothing else is being printed by that line

i hope its clear now??

no, its still not clear, after printing ‘A’ its giving new line then “hello” is being printed in new line, why is “hello” being printed in next line to ‘A’

why am I not getting responses

to print address of char you have to typecast it to int

if you try to print address of char then it start printing the value stored at that address and print till it doesn’t encounter ‘\0’

in this case just after A there will be a ‘\n’ present in memory hence it is printing a new line it is random if you try this in another machine you may get different output

in my machine this is shown

it is random not predictable
there is no hidden concept in this

okay thanks, atleast you answered after 4days.

sorry for inconvenience
but as soon as i got your doubt
i replied immediately

you must have reopen the doubt later

is your doubt resolved now ?
can i mark it as resolved

doubts have reached to you after I mailed to support team, thanks anyways, no it got resolved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.