Is there like a C programming dictionary for commands?

Started by fellowroot, April 04, 2013, 11:32:47 PM

Previous topic - Next topic

fellowroot

I'm taking a course in C and I run into stuff that I don't know all the time like:

fgets(buffer, BUFFER_SIZE - 1, stdin);

exit(EXIT_FAILURE);

return EXIT_SUCCESS;

and so on.

So is there like a C dictionary where I can look up stuff I don't know.


Bisqwit

You probably ought to ignore the details for now and concentrate on the message. You will understand those details as you gain insight into how functions work in general.

You can find a reference on C functions at many websites -- http://www.acm.uiuc.edu/webmonkeys/book/c_guide/ was the first one I found, but to understand them you need indeed to have that insight into how functions work in general.

STARWIN

i have been using http://www.cplusplus.com/reference/clibrary/ for years, whenever i need to check something about C. you can ignore all C++ stuff.

almost everything you write is defined in a header. so the information in this site is organized by the header file names. for example the stdlib.h page tells you what EXIT_FAILURE, exit etc mean. if you have a code file with unknown words, check the documentation related to the header files #included in that code file. this logic should solve most cases.

BRPXQZME

On a Unix system, you can use the man (manual) pages for any standard C library function (it may also tell you about functionality specific to that flavor of Unix, though, and not tell you that it's non-standard), for example, the command "man fgets" or "man 3 exit" at the command line. This is the way these were supposed to be looked up pretty early on. However, we don't all use Unix systems, and some of us are not familiar with the command line. In fact, while I recommend both of these things, the fact is that a majority of people learning programming use Windows. Usually we are not interested in the system-specific version of a function, either.

The point of telling you this is that you can go to Google and do a search like "man <function name>" (no quotes) and you will find a bare-bones explanation of what the function does, same as a Unix manual would tell you. You will probably not be given the whole picture; it may not explain things well enough for people who wouldn't already know what it does, and it will often not even tell you whether it's even a good idea to use that function! But if you are truly lost, it can give you enough of a description as to what you should look up next.

Constants and macros like EXIT_* would not generally be described in man pages, and for those you should consult the relevant header files.
we are in a horrible and deadly danger

henke37

And with "consult" he means "find and open in your code editor".

syntax error

You can get a cross-Compiler for almost every computer or console.

fellowroot

Thanks guys. I am checking out the links as I'm typing this.

Also I can't believe that I spelled dictionary wrong. Good god.