Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

printf statement including quotes and escape sequence

I’m having some trouble making a print statement that includes quotes and a new line escape sequence. I tried to use \n for a new line and backslash before open quote and before closing quotes to tell my program to include the quotations. I don’t know where I went wrong and I keep getting an error in my int main(void) line (sorry if I’m not using correct terminology, I’m in an intro c MOOC).

#include <stdio.h>
int main(void){
    printf("Dennis Ritchie said:\n\"The only way to learn a new programming language is by writing programs in it.\");
    return 0;
}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You’re only missing closing " and \n for readability:

printf("Dennis Ritchie said:\n\"The only way to learn a new programming language is by writing programs in it.\"\n");
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading