Guest_imported
New member
- Jan 1, 1970
- 0
howdy all,
I got a question.Suppose I a code like this:
const int x=5;
void main()
{
char A[x],B[x];
int C;
cout<<"Enter something; ";
cin>>A;
C=strlen(A);
==Here is the question,
Sample run:
Enter something: Joe
and then strlen returns 3.
Now can I use the return value from strlen int C, and
use it as an array index like this?--> B[C]
I actually tried this and got an error, obviously I cant change a const but is there a right way to do what I would like it to do.
I got a question.Suppose I a code like this:
const int x=5;
void main()
{
char A[x],B[x];
int C;
cout<<"Enter something; ";
cin>>A;
C=strlen(A);
==Here is the question,
Sample run:
Enter something: Joe
and then strlen returns 3.
Now can I use the return value from strlen int C, and
use it as an array index like this?--> B[C]
I actually tried this and got an error, obviously I cant change a const but is there a right way to do what I would like it to do.