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.

Space সহ পুরো লাইন পড়তে 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 মানে দুটি সমান।

Challenge

+30 XP

fgets দিয়ে একটি লাইন পড়ে তার vowels, consonants এবং spaces গুনুন। Input: Hello World Output: Vowels: 3 Consonants: 7 Spaces: 1

Output Loading C (first time takes a few seconds)
Press Run to see the result here.