Lesson 16 of 23
Strings: 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 എന്നിവ നൽകുന്നു.
Example: edit me and press Run
Output Loading C (first time takes a few seconds)
Press Run to see the result here.Spaces ഉൾപ്പെടെ മുഴുവൻ വരിയും വായിക്കാൻ fgets ഉപയോഗിക്കൂ. അത് അവസാനത്തെ \n നിലനിർത്തുന്നു, അത് strcspn ഉപയോഗിച്ച് നീക്കാം.
Example: edit me and press Run
Output Loading C (first time takes a few seconds)
Press Run to see the result here.Strings == കൊണ്ട് താരതമ്യം ചെയ്യാനാവില്ല (അത് addresses ആണ് താരതമ്യം ചെയ്യുന്നത്). strcmp(a, b) == 0 എന്നാൽ അവ തുല്യമാണ്.