To determing the length of a char or wchar_t array you can use either strlen function from <cstring> or wcslen function from <cwchar>.
Also array in C/C++ has no the assignment operator. So you can not use
ch="abcd";
you should use either strcpy or wcscpy to copy a string literal to a character array.
#include <string>
#include <iostream>
int main() {
int NumberOfFields;
std::wstring ch = "abcd";
NumberOfFields=ch.size();
cout<<"Number Of Fields: "<<NumberOfFields;
return 0;
}
If you really want to use character arrays, look for the terminating character. Whenever you use double-quotes in C++, there is a hidden character at the end '\0';