Electronics > Microcontrollers

C handling strings \n cubeide

(1/2) > >>

strawberry:
"◙ \n"
1:0x0A ASCII
2:\n doent work because \ is escape char

DavidAlfa:
What?

brucehoult:
The escape character is there exactly so that you get 0xA instead of the normal 'n' = 0x6E.

DavidAlfa:
If you really want to show "◙ \n", then use "◙ \\n" , special characters need to be escaped.
So \\ will print \. A single \ will escape the next char, but you already knew it!

https://www.w3schools.com/c/c_strings_esc.php
https://www.geeksforgeeks.org/escape-sequence-in-c/

strawberry:
for some reason scanning string doesn't return true
if (char == '\n')

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod