πŸ”€ What is a Char Array?

A char array is a collection of characters, just like a string, but stored in an array format.

cpp
Copy code
char name[10] = "Nikhil";

πŸ“Œ Important:


βœ… Declaring Char Arrays

➀ Method 1: Character by Character

cpp
Copy code
char name[6] = {'N', 'i', 'k', 'h', 'i', 'l'};

🚫 This won’t be treated as a string (no \0 at the end)


➀ Method 2: String Style (Recommended)

cpp
Copy code
char name[] = "Nikhil";

βœ… This includes the null character automatically. Memory allocated: 7 bytes.


πŸ“₯ Input & Output with Char Arrays

πŸ–¨ Printing

cpp
Copy code
char name[] = "Nikhil";
cout << name; // Output: Nikhil

🧾 Taking Input (1 word only)