I have to use scanf() for accepting name of user in NSString object.
If i use %s then it will show me error. My Code is :
NSString *name;
scanf("%s",&name); //It is showing error
scanf("%@",&name); //It also show me error
What I should do?
You can’t use
scanf(), since it can’t take aNSStringobject as an argument. You can first scan characters in achar *c-‘string’ and after that create aNSStringfrom it with- (id)initWithCString:(const char *)nullTerminatedCString encoding:(NSStringEncoding)encoding.