Jump to content

C "includes" explanation?

- - - - -

  • Please log in to reply
9 replies to this topic

#1
carbon

carbon

    Learning Programmer

  • Members
  • PipPipPip
  • 37 posts
Hi guys and happy New Year,

Where I can find explanations for includes in C programming language?

There is a lot of functions and it would be good to know some.

Thanks and once again happy New Year! :p

#2
Ancient Dragon

Ancient Dragon

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 400 posts
There's not much to explain about includes. When the compiler's preprocessor sees #include in the C source file it just opens the named file and processes it; when done processing the include it returns to the C file. Includes often contain includes. The compiler will treat all include files as if you had written then yourself. It makes your job as a coder a great deal easier to just include standard header files than it would be if you had to code them all over, and over, and over again.

One crevet -- do not put executable code in an include file. They should only contain function prototypes, typedefs, structures, and defines. (There are a couple exceptions which will become clear as you learn more about C language.)


#include <stdio.h>

#include <stdlib.h>

#include <string.h>


// your program's code does here


Visit Grandpa's Forums, a social networking forum, with family-oriented arcade games, blogs, discussion forums, and photo albums.

#3
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts
Happy new year!

I found this tutorial which is pretty good: Introduction to C - Cprogramming.com
Think my post we're usefull? Please take your time and press the Like button at my post, Big Thanks!
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/

#4
carbon

carbon

    Learning Programmer

  • Members
  • PipPipPip
  • 37 posts
No,no!

I know what is include and that stuff. I just want to know what functions I can find e.g. in <stdio.h> or <math.h>. For those two I know what functions are inside but I dont know what fuunctions are inside <getopt.h> and others.

Do you understand now?

#5
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts
You should look at the documentation of the header you are intrested in to know the functions of For example: getopt.c File Reference This is when i googled "C getopt reference"

I know that C# have its own site for reference all the classes available, Im not soo experienced with C
Think my post we're usefull? Please take your time and press the Like button at my post, Big Thanks!
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/

#6
gregwarner

gregwarner

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 853 posts
  • Location:Arkansas
This is the reference page for the C standard libraries:
C Library - C++ Reference
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.

– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid


#7
carbon

carbon

    Learning Programmer

  • Members
  • PipPipPip
  • 37 posts
I thougth there is a much more functions but its not.

#8
Ancient Dragon

Ancient Dragon

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 400 posts
If you want to know what functions are inside a file then just open the file with any text editor and read it. An alternative is to buy a good book that contains most of them which lists functions either alphabetically or by functionality.
Visit Grandpa's Forums, a social networking forum, with family-oriented arcade games, blogs, discussion forums, and photo albums.

#9
carbon

carbon

    Learning Programmer

  • Members
  • PipPipPip
  • 37 posts
Is there any book like that?

#10
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
Whatever C library you use may have a lot of supporting functions (possibly dozens of macros and functions for working with files) that you are not supposed to use on their own. The ones documented are usually the goodies that are well tested, work, and should work on other platforms.

edit:
Most good books should have a short reference area for functions with possible descriptions, however online references work just the same and are usually newer.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users