How do I get the current date in Cocoa

后端 未结 14 484
醉酒成梦
醉酒成梦 2020-12-04 09:39

I\'m getting started developing for the iPhone and as such I am looking at different tutorials online as well as trying some different things out myself. Currently, I\'m try

14条回答
  •  一生所求
    2020-12-04 10:18

    Also, I've noticed at different places and at different times the asterisk (*) is located either right after the time NSDate* now or right before the variable NSDate *now. What is the difference in the two and why would you use one versus the other?

    The compiler doesn't care, but putting the asterisk before the space can be misleading. Here's my example:

    int* a, b;
    

    What is the type of b?

    If you guessed int *, you're wrong. It's just int.

    The other way makes this slightly clearer by keeping the * next to the variable it belongs to:

    int *a, b;
    

    Of course, there are two ways that are even clearer than that:

    int b, *a;
    
    int *a;
    int b;
    

提交回复
热议问题