user2000809
user2000809

Reputation: 496

Objective-C: What is the significance of the "@" (at) symbol for NSLog (@"abc");?

And also, why is it not necessary for, eg:

printf ("abc")

Upvotes: 2

Views: 521

Answers (3)

Muhammad Noman
Muhammad Noman

Reputation: 128

UPDATE:
 NSLog(@"%@",dictionary) 

Tells the compiler that i got string to fulfill the requirement of string argument.

Update: Sorry I was supposed to write the "NSLog" instead of printf. my mistake!

Upvotes: 2

Scott Berrevoets
Scott Berrevoets

Reputation: 16946

NSLog takes an NSString as argument. @"abc" denotes an NSString because of the @ sign, so that is a valid argument for NSLog. printf is a normal C function that takes a C string, which is simply created using "".

Upvotes: 9

GregJaskiewicz
GregJaskiewicz

Reputation: 496

Because it requires NSString. Adding @declares value as type of NSObject (simplification).

Upvotes: 1

Related Questions