+ 1

Strings - can someone tell me the error in this program || note- I am new to strings and I want to know what is wrong with this

#include <iostream> //to find the length of a string using namespace std; int countstring(char a[]) { int count =0; for(int i =0;a[i]!='/0';i++) { count++; } return count; } int main() { char a[100];int c =0; cout<<"Enter the string";cin.getline(a,100); c =countstring(a); cout<<"The length of the string is"<<c; return 0; }

29th Nov 2017, 4:56 PM
RR2001
RR2001 - avatar
3 Respostas
+ 2
Thank you so much I got it
29th Nov 2017, 5:03 PM
RR2001
RR2001 - avatar
0
Is that all like I mean ,am I accepting and storing it in a character array?
29th Nov 2017, 5:01 PM
RR2001
RR2001 - avatar