I have declared a global variable like below
extern NSString *name;
@interface viewcontrollerOne{}
in implementation file i am accessing that g
extern is tipically used to create contants. If you want to Create a global variable string, you can do it in the following way:
.h
+ (void)setName:(NSString*)name_in;
+ (NSString*)name;
.m
NSString* gName;
@implementation ...
+ (void)setName:(NSString*)name_in{
gName = name_in;
}
+ (NSString*)name{
return gName;
}