My Basket
You have nothing in your shopping cart yet.
Title: c language for learners
Description: it is very easy to learn c program for beginners.
Document Preview
Extracts from the notes are below, to see the PDF you'll receive please use the links above
Introduction to the C Programming Language
Science & Technology Support
High Performance Computing
Ohio Supercomputer Center
1224 Kinnear Road
Columbus, OH 43212-1163
Table of Contents
•
•
•
•
•
•
•
•
•
Introduction
C Program Structure
Variables, Expressions, &
Operators
Input and Output
Program Looping
Decision Making Statements
Array Variables
Strings
Math Library Functions
•
•
•
•
•
•
•
•
•
User-defined Functions
Formatted Input and Output
Pointers
Structures
Unions
File Input and Output
Dynamic Memory Allocation
Command Line Arguments
Operator Precedence Table
2
C Programming
Introduction
•
Why Learn C?
3
C Programming
Why Learn C?
•
•
•
•
•
•
•
•
•
Compact, fast, and powerful
“Mid-level” Language
Standard for program development (wide acceptance)
It is everywhere! (portable)
Supports modular programming style
Useful for all applications
C is the native language of UNIX
Easy to interface with system devices/assembly routines
C is terse
4
C Programming
C Program Structure
•
•
•
•
•
Canonical First Program
Header Files
Names in C
Comments
Symbolic Constants
5
C Programming
Canonical First Program
•
The following program is written in the C programming language:
#include
...
All commands in C must be lowercase
...
End of each statement must be marked
with a semicolon
...
White space is
ignored
...
6
C Programming
Canonical First Program Continued
#include
...
•
This informs the computer as to where the program actually starts
...
The two braces, { and }, signify the begin and end segments of the
program
...
COMMON ERROR: unbalanced number
of open and close curly brackets!
•
7
C Programming
More on the Canonical First Program
#include
...
h> is to allow the use of
the printf statement to provide program output
...
Text to be
displayed by printf() must be enclosed in double quotes
...
• printf() is actually a function (procedure) in C that is used for printing
variables and text
...
There are some exceptions however
...
These characters are modifiers, and for the present the
\ followed by the n character represents a newline character
...
As we shall see later on,
what follows the \ character will determine what is printed (i
...
, a tab, clear
screen, clear line, etc
...
As will be discussed later, comments are useful for a variety of
reasons
...
9
C Programming
Header Files
•
•
•
•
Header files contain definitions of functions and variables which can be
incorporated into any C program by using the pre-processor #include statement
...
To use any of the standard functions, the appropriate header file should be included
...
For example, to use the function
printf() in a program, the line
#include
...
h
...
h and generally reside
in the /usr/include subdirectory
...
h>
#include