Loading topic
gcc. Nothing about pointers is assumed. This chapter only introduces addresses, and later chapte6 min read& and *.4 min read&, and dereference with *. It also assumes you know how a function call receives arguments. Pointer basics are covered in the previous chapter. The call stack gets its own chapter later, so here we only use the idea that each c4 min read&, and dereference with *. It also assumes you know that an array's elements sit next to each other in memory. Here you will learn what p + n, p - q, and p++ actually compute, which operations are legal, and where the beh4 min readint *p, &x, *p) and how pointer arithmetic scales by element size. Sizes below assume a typical 64-bit platform: int is 4 bytes and a pointer is 8 bytes. The C standard does not fix those numbers, and a GATE question normally states them.4 min readp + 1 moves a pointer by one element, and you know that an array name usually decays to a pointer to its first element. Combining * with ++ in one expression is a favorite GATE trap. The code is legal, but readers par4 min readsizeof behaves on arrays. Here we apply those rules to arrays of arrays. GATE questions on this topic mostly test three things: the type of each sub-expression, the ar4 min read*p++ precedence rules from the earlier chapters. C has no string type. A string is a convention: a sequence of char values in consecutive memory, ended by a byte with value 0. Almost every string question in GATE reduces to k4 min read&, dereference with *, and write a function that takes a pointer argument. It also assumes you know that arrays decay to pointers and that malloc returns a heap address. If any of these are shaky, review the earlier chapters 4 min readsizeof returns for arrays and pointers. It teaches you to decode any C declaration mechanically. It also shows how function pointers are declared, called and used. GATE questions rarely ask for more than three 4 min readsizeof yields a size_t, and understand that local variables live on the call stack. It covers the four standard allocation functions in <stdlib.h>, their exact behavior, and the traps that GATE questions use.4 min readmalloc and free, know that a pointer holds an address, and understand that local variables live in a stack frame that disappears when the function returns. It covers the ways heap and pointer code goes wrong, and which of those ways the C standard defines.4 min readmalloc and free, and how arguments are passed by value. It builds the linked list, the data structure GATE questions most often use to test those skills.4 min readstruct and malloc. Here we sort recursive functions into three recurring shapes. Each shape tells you how many calls to expect, how deep the stack4 min read*p++, explain array decay, and write a simple recurrence. The goal here is a repeatable routine for exam questions, plus a list of the traps that c4 min read