Friday, July 31, 2009

I don't understand this Question for programming in C?

Write a program that reads the three strings syzy, “suzy” and ‘suzy’. Are the single and double quotes ignored by C or read as part of the string?


Can anyone help me out. Please answer only if you know the question. Thanks

I don't understand this Question for programming in C?
The single and double quotes are not treated any different by C when you're reading them from stdin (scanf/gets/getc/cin). If they're passed as arguments, your command interpreter (shell on unix, dos/cmd.exe on windows) will interpet the quotes (effectively hiding them from your program) unless they're escaped.


No comments:

Post a Comment