Entrance Exams
Govt. Exams
int a = 5;
int *p = &a;
int **q = &p;
printf("%d", **q);
q is a pointer to pointer p. **q dereferences q to get p, then dereferences p to get the value 5.
String functions expect null terminator. This array has no '\0', so it's a character array but NOT a proper string for str* functions.
First dimension can be omitted, but second must be specified: int arr[][4]. Option C (int **arr) is not equivalent - it's pointer to pointer.
%s format specifier stops reading at whitespace. To read entire line including spaces, use fgets() or %[^\n].
\n is a single character (newline). 'Hello' = 5 + \n = 1 + 'World' = 5, total = 11 characters (not counting null terminator).
Array names are non-modifiable lvalues. You cannot use ++ on them. However, individual elements can be accessed and modified.
arr + 3 points to the 4th element (0-indexed). Dereferencing with * gives its value, equivalent to arr[3].
Arrays decay to pointers when passed to functions. Only the address of the first element is passed, not a copy of entire array.
strncat() allows specifying maximum characters to concatenate, preventing buffer overflow. strcat() has no size limit.
sizeof(arr) returns the total size of the array in bytes. For char arr[100], it returns 100 bytes regardless of content.