Understanding Pointers In C By Yashwant Kanetkar Pdf _top_ Page

| Pointer Type | p++ moves by | | :--- | :--- | | char * | 1 byte | | int * | 4 bytes (usually) | | double * | 8 bytes |

void *vp = malloc(20); // generic pointer int *ip = vp; // implicit conversion in C (C++ requires cast) understanding pointers in c by yashwant kanetkar pdf

One of the most practical lessons in the PDF is the concept of the null pointer. Kanetkar insists you always initialize pointers to NULL if they don’t have a valid target. He then shows how to check for null before dereferencing: | Pointer Type | p++ moves by |

Let’s simulate a lesson from the book. If you download the understanding pointers in c by yashwant kanetkar pdf , here are the three critical insights you will gain. If you download the understanding pointers in c

int *p = 100; // WRONG (unless 100 is a memory address)

Happy coding, and never dereference a null pointer.