/* Use printf() to print the first 11 characters of source_str. */
printf(First 11 characters: ‘%11.11s’n, source_str);
A pointer value is a data object that refers to a memory location. Each memory locaion is numbered in the memory. The number attached to a memory location is called the address of the location.
A static function is a function whose scope is limited to the current source file. Scope refers to the visibility of a function or variable. If the function or variable is visible outside of the current source file, it is said to have global, or external, scope. If the function or variable is not visible outside of the current source file, it is said to have local, or static, scope.
A pointer variable is a variable that may contain the address of another variable or any valid address in the memory.
A void pointer is a C convention for a raw address. The compiler has no idea what type of object a void Pointer really points to. If you write
ip points to an int. If you write
p doesn’t point to a void!
In C and C++, any time you need a void pointer, you can use another pointer type. For example, if you have a char*, you can pass it to a function that expects a void*. You don’t even need to cast it. In C (but not in C++), you can use a void* any time you need any kind of pointer, without casting. (In C++, you need to cast it).
A void pointer is used for working with raw memory or for passing a pointer to an unspecified type.
Some C code operates on raw memory. When C was first invented, character pointers (char *) were used for that. Then people started getting confused about when a character pointer was a string, when it was a character array, and when it was raw memory.