Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Difference between single (') and double (") quotes?
What's the difference in usage between single (') and double (") quotes in Objective-C? I'm seeing that there clearly is one, because I tried to write code that required single quotes with double ones, and it didn't execute properly. However, I'm not seeing what that difference is. Can anyone explain?
Michael Hulet47,909 Points
Single quotes denote a single character in the C programming language, but double quotes denote a string of characters. In other words:
//Single quotes can only hold a single character... char character = 'a'; //...but double quotes can hold any amount of characters char string = "A string of characters";
I assume you are talking about a printf statement. If you use those interchangeably your going to get an error. It's going to get confused wether your talking about a single quote or an apostrophe . That's my guess. I'm new to C and Objective-c as well.