C Programming – Day 6 | Strings in C (Characters & Text Handling) Explained
STRINGS IN C (Characters & Text Handling)
DAY - 6
✅ We continue your learning progress 🚀
📍 Day-6 — Strings in C (Characters & Text Handling)
Today we will learn:
✅ What is a string?
✅ Declaring & printing strings
✅ Input methods: scanf() vs gets()
✅ String functions
✅ Task + Quiz
✅ 1️⃣ What is a String?
📌 A string is a collection of characters ending with '\0' (NULL character)
Example:
Memory Layout:
✅ 2️⃣ Input & Output Strings
✅ Using scanf()
✅ Using gets() — takes full sentence
✅ Using puts() — prints string
⚠ Note: gets() is unsafe in real world, but good for learning.
✅ 3️⃣ String Functions (from <string.h>)
| Function | Meaning |
|---|---|
strlen(str) | Count characters |
strcpy(dest, src) | Copy string |
strcat(str1, str2) | Join strings |
strcmp(a,b) | Compare strings |
Example:
🧪 Practice Example: Count Vowels
✅ Task-6
Write a program to:
✔ Input your full name
✔ Count and print:
-
Total characters
-
Total vowels
Example Output:
📌 Hint: use loop until '\0' reached
📌 Include <string.h> optional
➡ Send your code — I will fix if needed ✅
📝 Quick Quiz — Day-6
Reply like: 1C, 2A, 3B
1️⃣ Strings in C end with:
A) space
B) tab
C) NULL \0
2️⃣ Which function joins two strings?
A) strcat()
B) strcmp()
C) strlen()
3️⃣ Which function counts characters?
A) strcpy()
B) strlen()
C) printf()
✅ Once you finish:
➡ Day-6 Completed
➡ We proceed to Day-7 (Functions in C) 🔥
Send your Task-6 Code and Day-6 Quiz answers when ready! 😄

No comments
Thank You For Visit My Website.
I Will Contact As Soon As Possible.