Entrance Exams
Govt. Exams
Array name acts as pointer to first element in expressions but they're distinct. &arr and arr differ in type.
This allocates row pointers only. Each row needs allocation: arr[i] = (int*)malloc(m * sizeof(int));
%p prints pointer values. NULL representation depends on implementation, commonly shown as 0x0 or (nil).
p is not initialized to valid address. Dereferencing causes undefined behavior (writing to random memory location).
Pointers of same type can be compared using <, >, ==, !=. Comparing with integers or different types is invalid.
p points to arr[0]. *p = 5 modifies arr[0]. Printing arr[0] displays 5.
Parentheses around *ptr give pointer priority. It's a pointer to a function taking 2 ints and returning int.
Both p and q point to same address of x, so p == q evaluates to true (1).
Passing address allows function to modify original variable. *x = 20 changes the value at that address.
Dangling pointer occurs when memory is freed but pointer still references that location. This causes undefined behavior.