Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

cybrscot

macrumors 6502
Original poster
Dec 7, 2010
282
0
Somewhere in Southeast Asia
Just curious, so far I've used the <stdio.h> header for everything. Will I ever use anything else? If you were to break it down, what % of programming is the <stdio.h> header? 90%? 50%

Just wondering how common this one is, and if others are just not as useful or for very specific purposes.

Thanks
Scott
 
You need this file for I/O (Input/Output). If you care to, you can look at it... it should be in /usr/include. Explaining the specifics might not be that helpful if you haven't used your own .h files yet. At a very high level, these files are used to define function prototypes (since you haven't used functions, what a function prototype is won't really make sense), constants using #define (don't think you've covered this yet, either), typedefs (probably not yet), structs (don't think you've seen them), and assorted other pieces of data you'll need to make use of a standard library. Basically, someone else wrote some code. You may or may not have access to the source code, but you do have a compiled library. They have provided you with a header file that will act as a guide for what functions are available (to help both you and the compiler) and what datatypes will be used when interacting with the library.

A lot of programs make use of file and console I/O, so a lot of programs will use this file. I don't think anyone could say a percentage, but it's much closer to 100% than 0% or 50%.

-Lee
 
Any of the following 'Standard C' libraries are likely to be referenced sometime within your textbooks.

<assert.h>
<ctype.h>
<errno.h>
<float.h>
<limits.h>
<math.h>
<setjmp.h>
<signal.h>
<stdlib.h>
<stddef.h>
<stdarg.h>
<stdio.h>
<string.h>
<time.h>

And these not quite as much in the United States.

<locale.h>
<wchar.h>
<wctype.h>
 
Any of the following 'Standard C' libraries are likely to be referenced sometime within your textbooks.

<assert.h>
<ctype.h>
<errno.h>
<float.h>
<limits.h>
<math.h>
<setjmp.h>
<signal.h>
<stdlib.h>
<stddef.h>
<stdarg.h>
<stdio.h>
<string.h>
<time.h>

And these not quite as much in the United States.

<locale.h>
<wchar.h>
<wctype.h>

Forgive me for this, because I don't have a teacher. I thought the "C library" was a single all encompassing "library" of everything of use related to C programming? Are you saying that each header you mentioned above, actually represents a "different and unique" library within C? And each library has different functions, etc?
 
Forgive me for this, because I don't have a teacher. I thought the "C library" was a single all encompassing "library" of everything of use related to C programming? Are you saying that each header you mentioned above, actually represents a "different and unique" library within C? And each library has different functions, etc?

This will become more clear to you by the time you get to chapter 9 and start writing your own functions. Not all code needs to be in a single function main or a single *.c file.

Read: http://en.wikipedia.org/wiki/C_standard_library

One library, several files and functions.

B
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.