I'm trying to declare an array of size 10,000. Preferably a character array. Then I may take the input of any size n(<=10,100). And I want to find this n.
I have a code which is not working.
int main()
{
char arr[10000];
cin >> arr;
cin.sync();
int l=0;
for(int i=0; ; i++)
{
if(arr[i]=='\n')
break;
l++;
}
cout << l;
return 0;
Input : Hell I expect the output to be 4, but the actual output is 4482.