#include
#include
#include
int main(int argc, char *argv[]){
int fir; //badly named loop variable
char *in
//Task = get length of argv
string text=*argv; //assigning charValue to string variable "text"
int l=text.length(); //getting the length of the string & assigning to variale "l"
//this loop just outputs result on the screen
for (int i=0; i<l; i++) {
cout << *(*argv+i) << flush;
}
Not sure why no one has suggested changing strlen to refer to a specific entry in the array of pointers to char?
strlen(argv[0]) // also, 1, 2, up to (argc - 1)
Also, http://www.cdecl.org/ helps in confirming that the char *argv[]
statement is: declare argv as array of pointer to char