ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Dear all,
I am having few questions regarding c (I am starting a new thread) as I do not want to mix those with me previous network programming questios, I posted here earlier.
1) I found that one can get information about basic c function from linux bash with man... Well I have to admit that I did not expect that. I thought that the man is only related to the bash linux only. Where it gets the information for the the c libraries. How it distingushes between c and bash commands?
2) I have found in my c document a text about macros. What is a macro? Is for example the sizeof myvariable a macro? Where these are declared?
3) IF i have a struct lets call it mystruct and then I do memset(&mystruct,0, sizeof mystruct) this will set to zeros all the variables inside of the struct, regardless what type of variables it includes. Is not that right?
I would like ot thank you in advance for your help
Regards
Alex
in case of a macro the preprocessor will evaluate it and therefore they will replace mytype with int, so the syntax checker will see int.
in case of typedef the preprocessor will leave it as is (because it is not a macro) and the syntax checker will be able to handle them as different types.
so in case of macro (#define int mytype) void myfunc(int) and void myfunc(mytype) will be exactly the same, using typedef they will be incompatible, so you can distinguish them.
the compiler will generate the same code anyway.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.