Enumeration Types
An enumerated data type is an ordinal data type
that lists the valid data values for a variable of this
data type.
The values of the enumerated data type are
constants of type int.
The integer value of the first element of the
enumera
Mathematical Functions
There are many mathematical functions in C math
library.
Example
#include <math.h> / requires lm in gcc
#include <stdio.h>
int main(void)
cfw_
double a = 3.0, b = 2.0, c, d, e, f, g;
c = sqrt(a);
d = pow(a,b);
/* 3 squared */
e =
Character Processing
The type char is one of the fundamental types.
Each character is stored in a machine in one byte,
where 256 distinct values can be represented.
When a character is stored in byte, the content can
be thought of as either a character
CSE130
Instructor: Ahmad Esmaili
Office Location: CS Bldg. Room 210
Office hours: MWF 11:00am-12:00pm,
or by appointment
Email: [email protected]
Phone: 631-632-1628
CSE130 Textbook info
Programming in C
by Stephen Kochan
Sams, Pearson Education,
Structured Programming
Is a problem-solving strategy and a programming
methodology that includes the following rules:
- The flow of control must be as simple as possible.
- The construction of a program should be embody
top-down design (stepwise refineme
C Program Format
preprocessing directives
int main(void)
cfw_
variable declarations
program statements
return 0;
Identifiers
A name assigned to a variable, function, etc.
Must start with letter or underscore.
Additional characters can be of any
combin
Arrays
An array is a sequence of data items that are of the same
type, that can be indexed and stored contiguously.
Arrays are used to represent a large number of
homogeneous values.
The elements of an array are accepted by the use of
subscripts.
Arra
Relational Operators
Take two data values of the same type and
returns a boolean result (0 for false and 1 for
true)
Any zero value is false and any non-zero
value is considered to be true.
Relational Operators are as follows:
< less than
> greater th