+ 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; }
2 Réponses
+ 2
Thank you so much I got it
0
Is that all like I mean ,am I accepting and storing it in a character array?