
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Address of a Function in C or C++
In C or C++, the variables are stored into memory, so we can get their memory addresses. Similarly, the functions also are stored into the memory, so they also have some addresses. To get the address we can use the function name only without using the parenthesis.
Please check the following program to get the clear idea.
Example
#include <stdio.h> void my_function() { printf("Hello World"); } int main() { printf("The address of the my_function is: %p\n", my_function); printf("The address of the main is: %p\n", main); }
Output
The address of the my_function is: 0000000000401530 The address of the main is: 000000000040154B
Advertisements