0

I didn't understand the concept strings

3rd Aug 2018, 10:37 AM
shobbithaa shre
shobbithaa shre - avatar
5 odpowiedzi
+ 4
Strings are written in quotation marks => one indicates starting of string and another one for end of string. Suppose you want to use " in your string for example printf("Nice to "help" you"); Compiler will understand that you want to end string and will end it at beggining of help. So to include quotation mark in your string you have to use special character called back slash (\). It will tell compiler to consider it as special case and not end string , just add it to string. printf("Nice to \"help\" you"); Hope this explanation helps☺️☺️.
3rd Aug 2018, 11:19 AM
Meet Mehta
Meet Mehta - avatar
+ 1
Okay thank you. Why do we use backslash in strings in python and when we use it
3rd Aug 2018, 10:52 AM
shobbithaa shre
shobbithaa shre - avatar
+ 1
Back slashes are known as escape sequences/characters and are used for special purposes.. For ex.. you need a new line in a String..so you can add\n for a new line.. other characters: \ (a-Alarm,b- Backspace,t-horizontal tab..etc.. check Python documentation..) and \\for adding a backslash in a String.. They are present because you cannot do these operations directly by keyboard (or are difficult).. Hope this helps
3rd Aug 2018, 11:01 AM
Ultra Yam ZGH
Ultra Yam ZGH - avatar
0
string is use for words or sentences in other meaning to store more than one charecter. String is array of charecters.
3rd Aug 2018, 10:44 AM
B K
0
https://msdn.microsoft.com/en-us/library/6aw8xdf2.aspx if you mean \n see the link. \n means new line . or if you mean // or / this is use to show the path to file.
3rd Aug 2018, 10:59 AM
B K