Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword or section
Like this
2Activity

Table Of Contents

0 of .
Results for:
No results containing your search query
P. 1
'C' Programming by NIKHIL

'C' Programming by NIKHIL

Ratings: (0)|Views: 169|Likes:
Published by Nikhil Thakur
Short and sweet is the key... I have always believed in "Work smart not hard". For all of those who feel the same this guide is for them. No other copy of this is available throughout the web. 'guaranteed' coz i created it through gathering info through various resources!!! So enjoy guys... Send in ur reviews at: nikhil.thakur4@gmail.com
Short and sweet is the key... I have always believed in "Work smart not hard". For all of those who feel the same this guide is for them. No other copy of this is available throughout the web. 'guaranteed' coz i created it through gathering info through various resources!!! So enjoy guys... Send in ur reviews at: nikhil.thakur4@gmail.com

More info:

Published by: Nikhil Thakur on Jun 13, 2011
Copyright:Attribution Non-commercial

Availability:

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

06/13/2011

pdf

text

original

 
C programming by NIKHIL
1 |
Page
 
 
Introduction to C programming language PAGE-2
 
ariables in C programming language PAGE-8
 
O
perators in C programming language PAGE-12
 
B
ranching Statement in C programming language PAGE-15
 
L
ooping Statement in C language PAGE-20
 
C Storage Classes PAGE-21
 
F
unctions in C programming language PAGE-22
 
T
he C Preprocessor PAGE-24
 
Input/
O
utput 
F
unctions in C programming language PAGE-26
 
F
ile Input/
O
utput 
F
unctions in C PAGE-29
 
Pointers in C PAGE-30
 
 Arrays in C PAGE-35
 
D
ynamic Memory Allocation in C PAGE-39
 
Strings in C PAGE-42
 
Structures in C programming language PAGE-47
 
C programming by NIKHIL
2
|
Page
 
Introduction to C Programming
y
In 1972, C was developed at Bell Laboratories by Dennis Ritchie.
y
C is a simple programming language with a relatively simple to understand syntax and fewkeywords.
y
C is useless.C itself has no input/output commands, doesn't have support for strings as afundamental data type. There is no useful math functions built in.
y
C requires the use of libraries as C is useless by itself. This increases the complexity of theC.The use of ANSI libraries and other methods,the issue of standard libraries is resolved.
C Programming :: A Quick Hello World Program
Let's give a simple program that prints out "Hello World" to standard out. We'll call our  program as hello.c.#include <stdio.h>main() { printf("Hello, world!\n");return 0;}
Explanation of The Above Code:
y
 
#include <stdio.h> -This line tells the compiler to include this header file for compilation.
o
 
What is header file?They
contain prototypes
and other compiler/pre- processor directive.Prototypes are also called the basic abstract functiondefinitions.
 
C programming by NIKHIL
3
|
Page
 
o
 
Some common header files are
stdio.h,stdlib.h, unistd.h and math.h
.
y
 
main()- This is a function, in particular it is the main block.
y
 
{ } - These curly braces are equivalent to the stating that "block begin" and "block end".These can be used at many places,such as switch and if statement.
y
 
 printf() - This is the actual print statement which is used in our c programfraquently.we have header file stdio.h! But what it does? How it is defined?
y
 
return 0-What is this? Who knows what is thisSeems like trying to figure out all this is just way too confusing.
y
 
Then the return 0 statement. Seems like we are trying to give something back, and itgives the result as an integer. Maybe if we modified our main function definition: intmain() ,now we are saying that our main function will be returning an integer!So,youshould always explicitly declare the return type on the function.
y
 
Let us add #include <stdlib.h> to our includes. Let's change our original returnstatement to return EXIT_SUCCESS;. Now it makes sense!
y
 
 printf always returns an int. The main pages say that printf returns the number of characters printed.It is good programming practice to check for return values. It willnot only make your program more readable, but at the end it will make your programsless error prone. But we don't really need it in this particular case.So we cast thefunction's return to (void). fprintf,exit and fflush are the only functions where youshould do this.
y
 
What about the
documentation
? We should probably document some of our code sothat other people can understand what we are doing. Comments in the C89 standardare noted by this: /* */. The comment always begins with /* and ends with */.

Activity (2)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads

You're Reading a Free Preview

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