Monday, November 1, 2010

The following program compiles:

#include <iostream>
using namespace std;
int main() {
  cout << '"' << endl;
  return 0;

This code streams out the " character. Sometimes when you want to quote something, this looks nicer than "\"".

Note that streaming """", """""", or any other even number of double quotes streams nothing because "" next to "" concatenates the empty string with the empty string.

No comments:

Post a Comment