Constant pointers cannot modify the address they are holding, while pointers to constants cannot modify the data being pointed to. There are four types of pointers in C: int * allows modifying both the data and address; const int * allows modifying the address but not the data; int * const allows modifying the data but not the address; and const int * const allows modifying neither the address nor data. A callback function is a function passed as an argument to another function that is then called by the other function, allowing code to call back the original function.
Constant pointers cannot modify the address they are holding, while pointers to constants cannot modify the data being pointed to. There are four types of pointers in C: int * allows modifying both the data and address; const int * allows modifying the address but not the data; int * const allows modifying the data but not the address; and const int * const allows modifying neither the address nor data. A callback function is a function passed as an argument to another function that is then called by the other function, allowing code to call back the original function.
Constant pointers cannot modify the address they are holding, while pointers to constants cannot modify the data being pointed to. There are four types of pointers in C: int * allows modifying both the data and address; const int * allows modifying the address but not the data; int * const allows modifying the data but not the address; and const int * const allows modifying neither the address nor data. A callback function is a function passed as an argument to another function that is then called by the other function, allowing code to call back the original function.
Const Pointer: constant pointer is a pointer that cannot change the address its holding.
Difference Between Constant Pointers and Pointer to Constants in C.
Constant pointers: 'int *const ptr Pointer to Constants: const int *ptr main() { int * ptr; int const * ptrToConst; int * const constPtr; int const * const constPtrToConst; *ptr = 0; // OK: modifies the "pointee" data ptr = NULL; // OK: modifies the pointer *ptrToConst = 0; // Error! Cannot modify the "pointee" data ptrToConst = NULL; // OK: modifies the pointer *constPtr = 0; // OK: modifies the "pointee" data constPtr = NULL; // Error! Cannot modify the pointer *constPtrToConst = 0; // Error! Cannot modify the "pointee" data constPtrToConst = NULL; // Error! Cannot modify the pointer } Callback function: Callback function is a function that is called through a function pointer. If you pass the pointer of a function as an argument to another, when that pointer is used to call the function it points to it is said that a call back is made. void cbfunc(int x) { printf("%d\n", x); } main () { /* function pointer */ void (*callback)(int); /* point to your callback function */ callback = &cbfunc; /* perform callback */ callback(5); }