I want to know about the difference between the NSLog and the Printf statement in Objective-C (for application purpose...!)
Why do all deve
I see two main differences between NSLog and printf:
NSLog supports NSString objects through the %@ extension;
furthermore, NSLog automatically adds time and process data (e.g., 2012-01-25 17:52:10.479 process[906:707])
printf() is a C standard library function, accepting a C string constant (const char *) as its format argument. printf() writes to stdout.
NSLog() is a Foundation function, accepting a constant NSString as format, and has an extended format specifier set (for example, printf() does't print objects specified by %@, NSLog() does).
NSLog() also prints the process name and date before it prints the actual format and writes to sdterr.
Basically, we can say that NSLog() is an extended printf()
Style function for Objective-C (more precisely, Cocoa and Cocoa Touch) and specific purposes.
NSLog is like a printf, but it does a bit more:
@ operator for objects which displays the string provided by the object's description method. (description is part of NSObject, so all objects can override it to return a string that describes the object).From a developer point of view, the biggest difference is that NSLog supports Objective-C object types via the %@ format. NSLog also writes to stderr, while printf writes to stdout.