Hello, the output of this code is 'ef' but if we add up a "newline" print after this print then the output becomes 'efd'. Then why in earlier scenerio the 'd' was not getting printed ?
Thanks in advance.
You print \n. Then you print ab\bcd on the second line. \b is the backspace leaving acd. Then you print \r which results in going to the start of the current line. Then you print ef. The lin already contained bcd so it will now contain efd with the position being on the d. If you add a printf("\n"); it would overwrite the d so the second line would contain bc then.
I'm not sure why the posted fragment prints efd for you. Maybe I'm wrong here. (Can't compile at the moment..)
As '\n' drops cursor one line down.
Then prints ab.
Then '\b' backspaces one character and prints cd. So now output is acd.
Finally '\r' returns carriage to beggining and overwrites ac with ef, so final output will be efd.
No it's not. Using gcc I get \nefd as output when printing \nab\bcd\refd and the output is \nefg when printing \nab\bcd\refdg. The newline doesn't overwrite the 'd' which I also edited in my last post, unsure why it didn't went through.
the web output is not correct.
plz check it on windows or linux system creating a .c file
Based on what knowledge? As stated in the other thread about this it seems pretty likely compilers deal with this in different ways. Aside from it being a "puzzle" I don't see much practical use for this by the way..
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...