+ 1
last string length
How can I get length of last string in array;What's wrong in here I'm begginer so sorry (C++) #include <iostream> #include <string> using namespace std; int n,z; int main(){ cin>>n; string a[n]; for(int i=1;i<=n;i++){ cin>>a[i]; } z=a[n].length(); cout<<z; }
1 Odpowiedź
0
sizeof(a[n]) instead of .length() I think