Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 21 days ago.
Improve this question
is there a way to obtain function's parameters, inside this function, without passing it. Like the func providing the function name. i'd like to obtain just name of parameters, not type.
search with google, found functions for line, function name and file name but nothing about parameters
The C standard does not provide any facility for this.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I saw this special macro when I read a source code. If I remember correctly, it is defined in the standard library.
The name of this macro is related to the buffer size, and in my machine its implementation is 1024.
Now I want to use it to initialize the buffer but I forgot what it is called.
So is there any one who can help me make my code look more professional?
If I don't know what I am looking for specifically, how can I clearly say what I need?
Are you talking about BUFSIZ? It's a macro provided by <stdio.h> and it expands to the size of the buffer used by setbuf().
I'm not sure what use it has in your own code.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I just had a question that whenever I write code I had to call all functions (predefined or user defined) in order to use or execute them. So why we don't have to call main function?
The main function is defined by the language itself as the designated start of the program. You don't need to call it because, in effect, your operating system (Linux, macOS, Windows, etc.) does.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm learning C. I wonder whether there is an instruction or command to recognize the type of the variable.
To be more practical: I have a program which works with integers, I want to show an error message if the user inserts a real number when running the program.
Hope you can help!
This is not part of the C standard, but GCC has the typeof keyword.
You have to be using the GCC compiler for it though.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a list of arrays, each with its own descriptive name.
How can I create a pointer to a particular array just using the name (ie string) of the array?
If I understand correctly, what you mean and what you want, then you want something as Map, Dictionary etc. For example, look at this question: Quick Way to Implement Dictionary in C
The C programming language is somewhat of a "low-level" language. It doesn't natively have any introspection constructs.
The names you see/use are just labels that are converted to addresses by the compiler when building a static executable, so the running code has no way to look up things by variable name.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'd love to create some part dynamically. Would it be possible to use offsetof with string as a second argument? Something like:
offsetof( tic, "close.v");
Or can I convert char to member anyhow?
The offsetof construct is a compile time operation. It can't be used with anything that is generated dynamically.