Stumbling my way through Class's and Objects. The Lynda Objective C is nice to also learn from besides the book. I had a question about this code sample.
I did not define any char variables (I know you don't need a char array working with strings) for this code to hold this string. The video said NSString is the Class. *word is the Pointer to the Object holding the "Laura" String.
Like 'int num = 50;' num is the container (4 bytes of memory) storing the value 50. Is 'word' the pointer and the container holding this string value, or is the 'Laura' string just saved someplace in memory and the 'word' Pointer is used to set it and get it in that memory address?
I am just trying to see how the nuts and bolts are working here, a better understanding. In my Pascal class we did not deal with Turbo Pascal, just Pascal. Strings were in Turbo Pascal and the teacher did not like them. Hello char arrays and for loops.
Thanks!
-Lars
Code:
NSString *word = @"Laura";
NSLog(@"Hello, %@", word);
I did not define any char variables (I know you don't need a char array working with strings) for this code to hold this string. The video said NSString is the Class. *word is the Pointer to the Object holding the "Laura" String.
Like 'int num = 50;' num is the container (4 bytes of memory) storing the value 50. Is 'word' the pointer and the container holding this string value, or is the 'Laura' string just saved someplace in memory and the 'word' Pointer is used to set it and get it in that memory address?
I am just trying to see how the nuts and bolts are working here, a better understanding. In my Pascal class we did not deal with Turbo Pascal, just Pascal. Strings were in Turbo Pascal and the teacher did not like them. Hello char arrays and for loops.
Thanks!
-Lars