CSC 357 Lecture Notes Week 2, Part 1
C Program Structure Pointers, Arrays, and Structs in C Memory
Management
#define MAXLINE 1000
#define name optional-parameters body
#define new(t) (t*) malloc(sizeof(t))
expands toListNode* node = new(ListNode);
ListNode* node = (ListNode*) malloc(sizeof(ListNode));
void insert(LinkedList* list, ListNode* node, int i);
though it is typical to include names for clarity.void insert(LinkedList*, ListNode*, int);
ListNode* newListNode(int value);
linked-list-test.c:31: warning: passing argument 2 of 'insert' makes pointer from integer without a cast