C

Topic: Pointers

When would you use a pointer to a function? 

Pointers to functions are interesting when you pass them to other functions. A function that takes function pointers says, in effect, ?Part of what I do can be customized. Give me a pointer to a function, and I?ll call it when that part of the job needs to be done. That function can do its part for me.? This is known as a ?callback.? It?s used a lot in graphical user interface libraries, in which the style of a display is built into the library but the contents of the display are part of the application.As a simpler example, say you have an array of character pointers (char*s), and you want to sort it by the value of the strings the character pointers point to. The standard qsort() function uses function pointers to perform that task. qsort() takes four arguments,?a pointer to the beginning of the array,?the number of elements in the array,?the size of each array element, and?a comparison function, and returns an int.

Browse random answers:

What does the error "Null Pointer Assignment" mean and what causes this error?
What are the advantages of using pointers in a program? 
What is the process of writing the null pointer?
Differentiate between ordinary variable and pointer in C.
How does normalization of huge pointer works?
What are the different types of pointers used in C language?
What is the difference between null pointer and wild pointer?
What is the function of dangling pointer?
What are pointers? Why are they used?
How pointer variables are initialized?
In C, why is the void pointer useful? When would you use it?
What is a void pointer?
What is a pointer variable?
What is a pointer value and address?
Difference between ordinary variable and pointer in C? 
What is NULL pointer?
What is a pointer?
What are the uses of a pointer?
When should a far pointer be used?
What are the pointer declarations used in C?
How to use realloc() to dynamically increase size of an already allocated array?
How many levels of pointers can you have?
Declare an array of three function pointers where each function receives two integers andreturns float.
What is :- pointer , NULL pointer , dangling pointer , far pointer , near pointer , huge pointer , generic pointer , smart pointer ?
Explain the variable assignment in the declaration

int *(*p[10])(char *, char *);
What is the difference between near pointer and far pointer?
What is dangling pointer in c? 
What are the pointer declarations used in C?
Differentiate between a constant pointer and pointer to a constant?
Discuss on pointer arithmetic?
What is the invalid pointer arithmetic?
What are the advantages of using array of pointers to string instead of an array of strings?
What is a huge pointer?
What is a normalized pointer, how do we normalize a pointer?
what are pointers integer?
What is pointer to a pointer?
Can a Structure contain a Pointer to itself?
Declare an array of three function pointers where each function receives two integers and returns float.
 Can you add pointers together? Why would you? 
What is a huge pointer?
What is “this”s pointer?
What is generic pointer in C?
What will be the output of the program ? #include<stdio.h>#include<string.h>int main(){    int i, n;    char *x="Alice";    n = strlen(x);    *x = x[n];    for(i=0; i<=n; i++)    {        printf("%s ", x);        x++;    }    printf("\n", x);    return 0;}
Point out the compile time error in the program given below.#include<stdio.h>int main(){    int *x;    *x=100;    return 0;}
What are the differences between malloc() and calloc()? 
What does it mean when a pointer is used in an if statement? 
When would you use a pointer to a function? 
Why should we assign NULL to the elements (pointer) after freeing them? 
How I can add two numbers in c language without using Arithmetic operators?
WRITE A C PROGRAMME TO FIND OUT THE AREA OF A CIRCLE USING POINTER.
How reliable are floating-point comparisons? 
What is a void pointer? 
Why should we assign NULL to the elements (pointer) after freeing them ?
How to operate pointers in any pragram & how to develop our logic while implementing pointer 
WRITE A C PROGRAMME TO PRINT THE FEBONACCI SERIES USING POINTER?AS:0,1,1,2,3,5,8,13,21........N 
Explain between a long pointer and a char pointer , which one consumes more memory?
Linked Lists -- Can you tell me how to check whether a linked list is circular?
The sizeof( ) function doesn’t return the size of the block of memory pointed to by a pointer. Why?
The sizeof( ) function doesn’t return the size of the block of memory pointed to by a pointer. Why?
What are FP_SEG And FP_OF ?