In this example I will show you the usage of NSLog function to print the long value on the console.
In this example I will show you the usage of NSLog function to print the long value on the console.The following code prints the long value on the console using the NSLog function.
//
// PrintLong.h
// DataTypes
//
//
#import <Foundation/Foundation.h>
@interface PrintLong : NSObject {
long _long ;
}
-(void) print;
-(void) set_long: (long) n;
@end
The implementation of PrintLong class is as follows:
//
// PrintLong.m
// DataTypes
#import "PrintLong.h"
@implementation PrintLong
-(void) set_long: (long) n
{
_long = n;
}
-(void) print
{
NSLog(@"long value is: %i", _long);
}
@end