c - Why aren't standard escape sequences like \a ,\v working?Why ' works without \,and is \? standard? -


why aren't \a (beep),\v(vertical tab) not working in program though standard according links below?and why single quotation mark working without using \'? , finally,is \? escape character @ microsoft site says,because use ? symbol inside printf() format string without \ , works fine.

to put clearly:

  • why \a , \v not working?

  • why single quote works without \ though \' escape sequence?

  • is \? escape sequence?(the link says ? works without \)

http://msdn.microsoft.com/en-us/library/h21280bw(v=vs.80).aspx http://en.wikipedia.org/wiki/escape_sequences_in_c

  • why \a , \v not working?

because console you’re using doesn’t support them. compiler does, , produces correct character code in output, terminal emulator ignores them.

  • why single quote works without \ though \' escape sequence?

because it’s unnecessary escape in strings, need escape in char literal. same \" string literal:

  • "'" vs. '\''
  • '"' vs. "\""
  • is \? escape sequence? (the link says ? works without \)

the link says different:

note … \? specifies literal question mark in cases character sequence misinterpreted trigraph

it’s there avoid ambiguity in cases following characters form valid trigraph, such ??= (which trigraph #). if want use sequence in string, need escape first (or second) ?.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -