0

I'm trying to do this :

void print(char *string){

int i = 0;

do{

    cout << string[i];
    i++;

} while (string[i] != '/0');

}

But on the output I have some weird results. How can I make this work. Am just trying to print out array of chars with a pointer to a 1st in line. TY

1 Answer 1

1

Your null character literal is wrong; you need backslash: '\0'.

Sign up to request clarification or add additional context in comments.

1 Comment

wow..can't believe that I didn't check that before posting.Lesson learned. Thank you sir !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.