Silly question but how can I output just one quotaton mark inside a string literal?

Oct 30, 2014 at 1:31am
I would like to know how it's possible to output a quotation mark inside a string literal? For example: " " ". Every time I try to do this, codeblocks thinks that I'm trying to add another string literal after another one.

1
2
3
4
5
6
7
8
9
10
#include <iostream>

using namespace std;

int main ()
{
cout << " " " << "\n";


} 
Oct 30, 2014 at 1:40am
cout << " \" \n";
characters which can not normally be placed inside a string can be by preceding them with a \

This also applies to \ itself. to have a string which contains a \ precede it with a \, e.g. filename = "c:\\junk.txt"
Last edited on Oct 30, 2014 at 1:44am
Topic archived. No new replies allowed.