int mystrlen (const char *s)
{
const char *t;
if (!s) return 0;
for (t=s-1;*++t;);
return t-s;
}
float *(*funptr)(int *); float *fun (int *); funptr= fun;
Answerchar (*funcp(int));
When a variable is passed by value, the function receives a copy of the variable. When a variable is passed by reference, the function receives a reference, or pointer, to the original data.
*function();this declares a pointer function!
function pointer is a variable that hold the address of any function which declared in the program but function pointer is the array of the function that accept the run time size of the function.
A pointer to a function is the memory address that stores the address of a function, while the pointer itself is a function pointer.A pointer to a function might be defined as "int (*pf)(int, int);", while to actually point to the function, you would use a function pointer, such as "pf = &func;".
void (*funptr)(void); void fun (void); int main () { funptr = fun; funptr (); }
A function f() will can be defined as returning a pointer to a character with the syntax char *f() { } One must be careful in creating these functions that the character pointer is set to point to a static variable or an allocated string; an automatic variable will vanish when the function exits, leaving the pointer invalid. I should point out that this is very basic C syntax. If this question is being asked as part of a school assignment, I must suggest that perhaps you should drop this course now, as it will be immeasurably harder as you get further into it.
constant pointer and character pointer
int main (int argc, char **argv):Hereargv is a pointer to a pointer (points to the first element of a pointer-array)argv[0] is a pointer (points to the first character of a string)argv[0][0] is a character
Pointer to Pointer is a double pointer, denoted by (**). Pointer stores the address of the variable and pointer to pointer stores the address of a pointer variable and syntax can be given as int **ptr2ptr;
Usable. A prominent example is param argv of function main.