Home Tutorial Iphone Examples Nslog NSLog array example

 
 

Share on Google+Share on Google+
NSLog array example
Posted on: July 29, 2009 at 12:00 AM
Advertisement
In this tutorial we will show you how to print the values of array using the NSLog function. Printing array values on the console is important debugging technique in iPhone application debugging.

The following code example explain it with running code example.

//
//  HelloArray.h
//  DataTypes
//
//

#import <Foundation/Foundation.h>  

@interface HelloArray : NSObject {   

    NSArray *arr; 

}

@end

The implementation of the class is as follows:

//
//  HelloArray.m
//  DataTypes
//
//

#import "HelloArray.h"

@implementation HelloArray

-(void) print{

     arr = [[NSArray alloc] initWithObjects:@"Me", @"Myself", @"I", @"and you", nil];

    NSLog(@"The content of arry is%@",arr);   

}

@end

The out put of the above example is:

The content of arry is(
    Me,
    Myself,
    I,
    "and you"
)
 

 

Advertisement

Related Tags for NSLog array example:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 29, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com