Re: Docs, questions and stuff
Re: Docs, questions and stuff
- Subject: Re: Docs, questions and stuff
- From: Phillip Mills <email@hidden>
- Date: Fri, 24 Aug 2001 09:33:18 -0400
On 8/24/01 8:51 AM, "email@hidden" <email@hidden> wrote:
>
A couple of questions for today: Can someone recommend the "Learning Cocoa"
>
book for a newbie like me?
I don9t think so. Before using "Learning Cocoa" you should know enough
about the language and frameworks to recognize where the book is leading you
wrong. (Of course, by that time you'll know more than the book can teach
you.)
>
What's the best way to learn ObjC? Should I begin
>
from Scratch with C++ and then go to ObjC?
Nooooooo! Unlike many (maybe all?) of the people on this list, I really
like C++. However, don't try to mix the two when you're not already
comfortable with either of them.
>
Can you recommend a good book for
>
"Learning ObjC"?
Learn C well. When you've done that, you can learn the ObjC extensions to C
using something like ObjC.pdf that comes with the developer documentation.
>
Finally. :-) How do I create an array for integers? Would be nice to get a
>
small snippet that creates an array of integers and is filling it inside a
>
for loop.
Here's two common ones...nothing to do with ObjC or Cocoa. Assume there are
bugs. :-)
#include <stdio.h>
#include <stdlib.h>
#define ARRAY_SIZE 5
int main(int argc, char *argv[])
{
int myArray[ARRAY_SIZE], i, *arrayTwo;
for (i = 0; i < ARRAY_SIZE; i++)
myArray[i] = i;
for (i = 0; i < ARRAY_SIZE; i++)
printf("%d\n", myArray[i]);
arrayTwo = (int *)malloc(ARRAY_SIZE * sizeof(int));
for (i = 0; i < ARRAY_SIZE; i++)
arrayTwo[i] = i;
for (i = 0; i < ARRAY_SIZE; i++)
printf("%d\n", arrayTwo[i]);
free(arrayTwo);
exit(0);
}