This code gives me the error message "warning: passing argument 1 of 'stringWithCString:encoding:' makes pointer from integer without a cast"
#import <Cocoa/Cocoa.h>
#import <Foundation/NSObject.h>
#import <stdio.h>
//#import <string.h>
@interface Numbers : NSObject
{
NSString *name;
int age;
NSMutableArray *list;
}
//-(void) setName;
-(void) setAge :(int)a;
@end
@implementation Numbers
-(void) setName{
// NSLog(@"What is your name?");
char n;
printf("What is your name? ");
scanf("%s", &n );
// name = [NSString stringWithUTF8String:n];
name = [NSString stringWithCString: n encoding: NSASCIIStringEncoding];
}
...
What could it be? Perhaps a header. I wish there was a better way to take input of strings. Using NSString is recommended over a regular cstring. I want to learn that because I plan on making more complex programs in the future.