Lesson 16 of 23
Strings: Character ArraysStrings: Character Arrays
11 min 30 XP
C-ல் string என்பது '\0' (null character) உடன் முடியும் char array. "Hi" உண்மையில் 3 bytes: 'H', 'i', '\0'. <string.h>-ல் strlen, strcpy, strcat, strcmp போன்ற functions உள்ளன.
In C a string is a char array ending with '\0' (the null character). "Hi" really takes 3 bytes: 'H', 'i', '\0'. <string.h> provides strlen, strcpy, strcat and strcmp.
Example: edit me and press Run
Press Run to see the result here.Space உள்ள முழு வரியைப் படிக்க fgets பயன்படுத்துங்கள். அது வரி முடிவில் உள்ள \n-ஐயும் சேர்க்கும்; strcspn மூலம் நீக்கலாம்.
Use fgets to read a whole line, including spaces. It keeps the trailing \n, which you can remove with strcspn.
Example: edit me and press Run
Press Run to see the result here.strings-ஐ == மூலம் ஒப்பிட முடியாது (அது addresses-ஐ ஒப்பிடும்). strcmp(a, b) == 0 என்றால் சமம்.
You can't compare strings with == (that compares addresses). strcmp(a, b) == 0 means they are equal.