Useful Functions Listed by Category.: - Arithmetic Types
Useful Functions Listed by Category.: - Arithmetic Types
Data Types
Scalar types
•Arithmetic types
Integral types: char, short, int, long
Floating-point types: float, double, long double
•Pointer types
•Aggregate types
•Array types
•Structure types
•Union types
•Function types
•Void types
1 Basic Types:
They are arithmetic types and consists of the two types: a integer types and b
floatingpoint
types.
2 Enumerated types:
They are again arithmetic types and they are used to define variables that can only be
assigned certain discrete integer values throughout the program.
3 The type void:
The type specifier void indicates that no value is available.
4 Derived types:
They include
Character constants
Escape sequence| Meaning
\\ \ character
\' ' character
\" " character
\? ? character
\a Alert or bell
\b Backspace
\f Form feed
\n Newline
\r Carriage return
\t Horizontal tab
\v Vertical tab
\ooo Octal number of one to three digits
\xhh . . . Hexadecimal number of one or more digits
Flow chart
To demonstrate flowchart techniques, take another look at the AC algorithm used in the
previous section.
if temperature >= 80
Turn AC on
else
Turn AC off
end if
This AC algorithm can also be easily represented using flowchart techniques, as shown in
Figure 3.2. The flowchart in Figure 3.2 uses a decision symbol to illustrate an expression. If the expression
evaluates to true, program flow moves to the right, processes a statement, and then terminates.
If the expression evaluates to false, program flow moves to the left, processes a
different statement, and then terminates.
As a general rule of thumb, your flowchart’s decision symbols should always move to the right
when an expression evaluates to true. However, there are times when you will not care if an
expression evaluates to false. For example, take a look at the following algorithm implemented
in pseudo code.
if target hit == true
Incrementing player’s score
end if
In the preceding pseudo code, I’m only concerned about incrementing the player’s score when
a target has been hit. I could demonstrate the same algorithm using a flowchart, as shown
in Figure 3.3.
Example
if action == deposit
Deposit funds into account
else
if balance < withdraw amount
insufficient funds for transaction
else
Withdraw monies
end if
end if
Conversion Specifiers:
scanf() gets()
Strings with spaces cannot be accessed
until ENTER key is pressed.
Strings with any number of spaces can
be accessed.
All data types can be accessed.
Only character data type can be
accessed.
Spaces and tabs are not acceptable as a
part of the input string.
Spaces and tabs are perfectly acceptable
of the input string as a part.
Any number of characters, integers.
Only one string can be received at a
time. Strings, floats can be received at a
time.
Control statements:
1. Un-conditional:
• goto
• break
• return
• continue
2. Conditional:
• if
• if – else
• Nested if
• switch case statement
3. Loop or iterative:
• for loop
• while loop
• do-while loop