开发者

What's a canonical example of code kata to learn about pointers?

I've never worked with a language that didn't provide for some form of memory management, and thus managed to get by without ever really groking pointers.

I can dabble in C I guess, as a result of coding in Objective-C for a开发者_开发知识库 little while.


Hmmm, maybe it's the single linked list.

Try it: create, populate, reverse, release a single linked list

struct node {
    int data;
    struct node *next;
};


I wouldn't call this "canonical", but I'm recreating [arrayOfStrings sortUsingSelector:@selector(compare:)]; using char * arrays and pure C code. It's sloppy and frustrating, but great practice and I'm loving it.

http://github.com/jkubicek/Objective-Sort/blob/master/Objective-Sort.m


I've started a small github project to collect objective-c katas: https://github.com/twobitlabs/xcode-katas

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜