Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
25Activity
0 of .
Results for:
No results containing your search query
P. 1
C Programming

C Programming

Ratings:

4.84

(67)
|Views: 6,446|Likes:
Published by Sneetsher Crispy
It is an open source (Free) ebook from Wikibook.org , to who want to learn C programming language from Zero to One.
It is an open source (Free) ebook from Wikibook.org , to who want to learn C programming language from Zero to One.

More info:

Published by: Sneetsher Crispy on Feb 01, 2009
Copyright:Attribution Non-commercial Share Alike

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

01/11/2013

pdf

text

 
C Programming/Print version
From Wikibooks, the open-content textbooks collection
Table of Contents
C Programming/Print version...............................................................................................................1From Wikibooks, the open-content textbooks collection............................................................1Introduction................................................................................................................................6Why Learn C?.................................................................................................................................6History of the C Programming Language.......................................................................................7Getting Started................................................................................................................................7Dev-C++.....................................................................................................................................9gcc..............................................................................................................................................9Introductory Exercises...................................................................................................................11Beginning C.............................................................................................................................12Basic Concepts..............................................................................................................................12Compilation: How Does C Work?................................................................................................12Integrated Development Environments (IDEs).............................................................................13Block Structure, Statements, Scope, and Whitespace...................................................................13Basics of Using Functions.............................................................................................................14The Standard Library....................................................................................................................14Comments and Coding Style.........................................................................................................14The Preprocessor...........................................................................................................................15Footnotes.......................................................................................................................................15Preprocessor..................................................................................................................................15Syntax Checking...........................................................................................................................16Object Code...................................................................................................................................16Linking..........................................................................................................................................16C Structure and Style.....................................................................................................................16Introduction...................................................................................................................................16Line Breaks and Indentation.........................................................................................................17Line Breaks...............................................................................................................................17Indentation................................................................................................................................18Comments.....................................................................................................................................18Single-line Comments..............................................................................................................19Multi-line Comments...............................................................................................................19Examples.......................................................................................................................................21Links..............................................................................................................................................21Handling divide by zero errors.....................................................................................................22Variables.......................................................................................................................................22Declaring, Initializing, and Assigning Variables..........................................................................23
 
Naming Variables.....................................................................................................................23Literals..........................................................................................................................................24The Four Basic Types...................................................................................................................24The int type..............................................................................................................................24The char type............................................................................................................................24The float type...........................................................................................................................25The double type........................................................................................................................25sizeof.............................................................................................................................................26Data type modifiers.......................................................................................................................26const modifier...............................................................................................................................26Magic numbers.............................................................................................................................27Using the const keyword..........................................................................................................27#define......................................................................................................................................27Scope.............................................................................................................................................28Other Modifiers............................................................................................................................28Concepts...................................................................................................................................29In this section...........................................................................................................................29Simple Input and Output...............................................................................................................29Output using printf().....................................................................................................................30Printing numbers and escape sequences...................................................................................31Placeholder codes................................................................................................................31Tabs and newlines................................................................................................................31Other output methods...................................................................................................................32puts()........................................................................................................................................32Input using scanf()........................................................................................................................33Examples.......................................................................................................................................33Operators and Assignments......................................................................................................33Trigonometric functions................................................................................................................34The acos and asin functions.....................................................................................................34The atan and atan2 functions...................................................................................................35The cos, sin, and tan functions.................................................................................................35Hyperbolic functions.....................................................................................................................35Exponential and logarithmic functions.........................................................................................36The exp functions.....................................................................................................................36The frexp, ldexp, and modf functions......................................................................................36The log and log10 functions.....................................................................................................36Power functions.............................................................................................................................37The pow functions....................................................................................................................37The sqrt functions.....................................................................................................................37Nearest integer, absolute value, and remainder functions.............................................................37The ceil and floor functions.....................................................................................................37The fabs functions....................................................................................................................37The fmod functions..................................................................................................................38Control..........................................................................................................................................38Conditionals..................................................................................................................................38Relational and Equivalence Expressions:.................................................................................39Logical Expressions:................................................................................................................40Bitwise Boolean Expressions...................................................................................................40The If-Else statement................................................................................................................41The conditional expression..................................................................................................42
 
The Switch-Case statement......................................................................................................43Loops............................................................................................................................................44While loops..............................................................................................................................45For loops...................................................................................................................................46Do-While loops........................................................................................................................47One last thing: goto.......................................................................................................................48Examples.......................................................................................................................................49Procedures and Functions.............................................................................................................49More on functions.........................................................................................................................49Writing functions in C..................................................................................................................50In general..................................................................................................................................50Recursion..................................................................................................................................51Static Functions........................................................................................................................52Using C functions.........................................................................................................................52C's Built-in Functions...................................................................................................................52Directives......................................................................................................................................53#include....................................................................................................................................53Headers................................................................................................................................54#pragma....................................................................................................................................54#define......................................................................................................................................54macros......................................................................................................................................57#error........................................................................................................................................57#undef.......................................................................................................................................57if,else,elif,endif (conditionals).................................................................................................58ifdef,ifndef................................................................................................................................58Standard Libraries.........................................................................................................................61Introduction...................................................................................................................................61Streams..........................................................................................................................................61FILE pointers................................................................................................................................62Opening and Closing Files............................................................................................................62Opening Files...........................................................................................................................62Closing Files.............................................................................................................................63Other file access functions............................................................................................................64The fflush function...................................................................................................................64The setbuf function..................................................................................................................64The setvbuf function................................................................................................................64Functions that Modify the File Position Indicator........................................................................65The fgetpos and fsetpos functions............................................................................................65The fseek and ftell functions....................................................................................................65The rewind function.................................................................................................................66Error Handling Functions.............................................................................................................66The clearerr function................................................................................................................66The feof function......................................................................................................................66The ferror function...................................................................................................................66The perror function..................................................................................................................66Other Operations on Files.............................................................................................................67The remove function.................................................................................................................67The rename function.................................................................................................................67The tmpfile function.................................................................................................................67The tmpnam function...............................................................................................................67

Activity (25)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
minamjah liked this
adddata liked this
Rohit Gawande liked this
ATL95148 liked this
parashar007 liked this
nissim47 liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->