Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

What is function or function pointer

+10 votes
asked May 3 by Rajkumar Yadav (220 points)
Function or function pointer kya hai

4 Answers

0 votes
answered May 12 by Peter Minarik (88,520 points)
edited May 13 by Peter Minarik
A function is a piece of code that achieves a certain functionality. This piece of code can be called from other locations. E.g. a function would calculate the average of the grades in a class, or print something to the standard output.

A function pointer is a memory address that points to the location of a function. Using a function pointer, functions can be passed around in the code, which is useful when you do not want to fix (or do not know) at build time which function you'll need to perform a certain task at runtime.

Check this out for function pointers in C: https://stackoverflow.com/questions/840501/how-do-function-pointers-in-c-work
0 votes
answered May 12 by Ganesha Kumar Gupta (140 points)
A Function or Function pointer is like a box were we store anything with address
0 votes
answered Jun 1 by PIYUSH (140 points)
A function is used perform a specific tasks whenever it is required in the program

a function pointer stores the address of code .
0 votes
answered Jun 4 by Lokesh Joshi (140 points)
A function is a block of code designed to perform a specific task, which can be called by name in a program to execute that task. It usually takes inputs (arguments) and may return an output. A function pointer, on the other hand, is a variable that stores the address of a function. This allows functions to be passed as arguments, stored in arrays, or assigned dynamically, enabling flexible and dynamic code execution. Function pointers are crucial in scenarios like callback functions, event handling, and implementing certain design patterns, allowing for more modular and reusable code.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...