473,394 Members | 1,828 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,394 software developers and data experts.

how can count how many variables from file in c code and also find how many function

how can count how many variables from file in c code and how many
function in c file please give answer write a c/c++ code
thanks
Feb 23 '18 #1

✓ answered by weaknessforcats

Are you trying to write a compiler? This is not a simple problem. If this is a homework problem, do you have a particular C file you are supposed to be using?

3 1313
weaknessforcats
9,208 Expert Mod 8TB
Are you trying to write a compiler? This is not a simple problem. If this is a homework problem, do you have a particular C file you are supposed to be using?
Feb 23 '18 #2
no , i read a file than count how many function in there but i could not <C file>
Feb 23 '18 #3
donbock
2,426 Expert 2GB
It is easier to parse a compiled object file than a C source file.
It is even easier to use a language like Perl to process the output of an object file parsing tool such as nm.

Is a list of symbols sufficient or do you need to distinguish function and variable names?
Is a list of global names sufficient or do you need to also get the local (static) names?

If you must parse a source file, are you allowed to enforce a no-typedefs rule? Typedefs complicate the source-parsing logic.

Can you parse the output of the C preprocessor or are you required to recognize and deal with macro definitions, macro references, conditional compilation, etc?
Feb 27 '18 #4

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

Similar topics

8
by: Jeffrey Silverman | last post by:
'nuff said. Just venting... -- Jeffrey D. Silverman | jeffrey AT jhu DOT edu Johns Hopkins University | Baltimore, MD Website | http://www.wse.jhu.edu/newtnotes/
1
by: Skip Montanaro | last post by:
The trace module allows you to print all functions which were called at least once during a program's run. I just checked in a change to also track caller/callee relationships and display then at...
8
by: G-Factor | last post by:
Hi all Been learning C++ for about 5 weeks. I find that I create quite a lot of variables. Generally, is it better to create a new variable for every different thing that needs to be stored in...
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...
7
by: Bryan Parkoff | last post by:
C/C++ Compiler encourages to limit 1,000 functions under function pointer, but I am allowed to overlimit 4,096 functions. I am just for fun to test how it works. The problem is that source code...
16
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will...
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...
8
by: Diwa | last post by:
Hi Guys, Is there any better way than below to find an int in a string (e.g. "30" in "KFStat30A") // -------------------------------------------------------------- #include <iostream>...
1
by: joseph terzi | last post by:
I am trying to use recursion to calculate the nth prime. It works up until i believe around 300 when the interpreter says "maximum recusrion depth exceeded." Here is the code i wrote. def...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.