Home Tutorial Iphone Examples Nslog NSLog array example

 
 

NSLog array example
Posted on: July 29, 2009 at 12:00 AM
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"
)
 

 

Related Tags for NSLog array example:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.