I am trying to find the length of the string which I am entering in the char array of size 10 using size(), strlen(),length() functions in c++ but they are not working why??? but instead of that char array if I would define a string ="Vishal " then use these functions are then they are working Why so???. And it is working in Case of the strings.
#include <bits/stdc++.h>
using namespace std;
int main()
{
char name[10];
cin >> name;
int count = 0;
for (int i = 0; i < name.size(); i++)
{
count++;
}
cout << count << "\n";
return 0;
}