473,396 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how can I find the addres of function

mail the ans on (email removed)
Oct 14 '12 #1
4 2005
weaknessforcats
9,208 Expert Mod 8TB
The name of a function is the address of the function.

You can just typecast the functon name to an int.
Oct 14 '12 #2
Can you plz tell me how to do that?
Oct 15 '12 #3
@ashu, If you write following code you will get address of function.

Expand|Select|Wrap|Line Numbers
  1. void display();
  2. int main()
  3. {
  4.        printf("address:=%u",&display);
  5.     return 0;
  6. }
  7. void display()
  8. {
  9.  printf("Hello");
  10. }
Oct 15 '12 #4
donbock
2,426 Expert 2GB
An int may not be large enough to hold an address. I suggest you use a long int.
Expand|Select|Wrap|Line Numbers
  1. long addr = &display;
  2. printf("address:=%lu\n",addr);
However, be aware that you are stepping into the realm of implementation-defined or undefined behavior. The Standard does not require a compiler to provide any integral types that can hold the value of a function pointer. In fact, a compiler is not required to provide a single pointer type that can hold both pointer-to-data and pointer-to-function.
Oct 17 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Nikolai Onken | last post by:
Hey, I got a rather more mathematical Problem but have no idea how to solve it: I have following values and want them to return other values as stated below: (Best seen with fixed pitch font)...
0
by: stephene | last post by:
I have a question about the compiler.ast module. Please bear with me if I am missing something obvious, I am not too sure how to use this module. I am using the compiler.visitor module to examine...
1
by: Saeed Amrollahi | last post by:
Dear All C++ Programmers Hello I am Saeed Amrollahi. I am a software engineer in Tehran Sewerage Company. I try to use std::map and map::find member function. I use Visual Studio .NET. my...
2
by: galsaba | last post by:
Is there a "Find" fucntion in Access? I found this is Excell Find (find_text, within_text, start_num). Where can i find a similar function is Access? galsaba
1
by: tigerwang1974 | last post by:
Hi, I had installed net-snmp-5.1.4 source package and php-4.3.9 source package complied with snmp options on my solaris9 server. I wrote a php script using snmpwalk() function to get some OIDs,...
5
by: SunnyDrake | last post by:
HI! I wrting some program part of it is XML config parser which contains some commands(for flexibility of engenie). how do i more simple(if it possible not via System.Reflection or...
3
by: a6000000 | last post by:
hello how to store the contents from existing <div id="map_canvas">contents</div> http://a6000000.kilu.de/tmp/gmstore.php as a image, maybe in javascript or AJAX_PHP where can we find a...
3
by: Payne | last post by:
Hello, I'm having trouble figuring out how to best explain my problem but I hope I can make myself clear enough. Anyway, I'm doing an assignment for school and in this one we're supposed to write a...
0
by: mustakbal | last post by:
I am using this code to search with wild cards for strings in a text file. I wanted to improve the application by adding a "Find Next " button that will display the rest of the strings that the...
4
by: Elliot Fraval | last post by:
Hi All, Environment is VBA code in Access 2007. I am having some problems performing a find and replace on text that originates from a memo field in a table. The code is supposed to take...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.