Q:

Confusion about declaring pointers to id

Please consider these 2 code statements:
id class1 = [[MyClass alloc]init]; //First 
MyClass * class2 = [[MyClass alloc]init]; //Second

class1 and class2 are pointers to type id right? In a header file of objc, I saw that Class is just typedef of a struct pointer, and id is typedef of a struct pointer as well. With those types being declared as pointers to struct, why do I need to include a * in the second statement of my code?

A:

id is a type. It can hold a pointer to any object.
Class is a type. It can hold a pointer to any class object. (A class object is the object representing a class. i.e. the object that gets messaged when you call a class (+) method.)
MyClass * is a type. It can hold a pointer to any object that is an instance of MyClass

class1 and class2 are pointers to objects.
You seem to have some big confusion between class objects and instances of classes. A MyClass * is a pointer to a MyClass instance, i.e. an object whose class is MyClass. That is completely different from the class object representing the MyClass class itself. The MyClass class object is not an instance of MyClass. Class objects are a more advanced topic that you should probably not think about now.

