CSC 201 Scribble
CSC 201 Scribble
Computer
a. Software
b. Program
c. Programming Language
i. Low-level Programming Language
ii. Mid-level Programming Language
iii. High-level Programming
Language
d. Structured Programming Language e.g.
C, C#, C++, Pascal, PHP, Java, Visual
Basic, Algor, Modula.
2. Methods of Solving Problems in
Programming:
a. Algorithm
b. Flowchart
c. Pseudocode
d. Code
3. C Language introduction
a. Structure of a C Program
i. Documentation
Comments
I. Single-line
II. Multiple-line
ii. Preprocessor directive
I. Header
iii. Global declaration
iv. Main function
v. Local declaration
vi. Program statements
I. Declarative (declaration)
Variables
Constants
II. Executable
vii. Call user defined functions
(optional)
viii. End of main function
ix. User defined function(s)
(optional)
x. Local declaration
xi. Statements
xii. End of user defined function(s)
(optional)
b. Functions
i. Inbuilt
ii. User-defined
c. Variables
i. Integer
ii. Float
iii. Double
iv. Character
v. String
vi. Short
vii. Long double
viii. Unsigned
d. Format specifier
i. %d – integer
ii. %f – float
iii. %c – char
iv. %lf - double
e. Error
i. Syntax
ii. Semantic
iii. Logical
f. Operators
i. Arithmetic
+, -, *, /, %, ++, --
ii. Relational
==, !=, >, <, >=, <=
iii. Assignment
=, +=, =+, -=, =-, *=, =*, /=, =/,
%=, =%, <<=, =<<, >>=, =>>, &=,
=&,^=, =^, |=, =|
iv. Bitwise
&, |, ^, <<, >>, ~
v. Logical
&&, ||, !
4. Programming Structure
Control Structure
i. Sequential
ii. Branching, Selection/Condition
I. If - else
II. Switch – case
iii. Loop/Iteration
5. Input/Output
a. Input – scanf()
b. Output – printf()
6. Array
type arrayName[n]
type arrayName[]
7. Function
a. Declaration
i. Return type
ii. Name
iii. Parameters (optional)
b. Definition
Body of function
e.g.
returnType functionName(parameters){
body of function;
return result;
}
c. Calling
e.g.
a = functionName(parameters)
8. Control structure
a. Decision
i. if block
if(condition 1){
statements;
} elseif(condition 2){
Statements;
} .
.
.
} else(condition n){
Statements;
}
ii. switch block
switch (statement){
case value 1:
statements;
break;
case value 2:
statements;
break;
.
.
.
case value n:
statements;
break;
default:
statements;
}
b. Iteration
i. for loop
for(type var=ini, end, steps){
statements;
}
ii. while loop
while(condition){
statements;
}
iii. do while loop
do{
statements;
} while(condition);
9. Errors
a. Syntax
or compilation error. typographical, detected at
compilation e.g. no semicolon, case sensitive error
for format identifier, keyword.
b. Semantic
When statement is not understandable to computer
e.g. uninitialized variable, wrong type for variable,
mistake in expression/statement, array out of
bound
c. Run-time
when an invalid valid e.g. divide by zero cause
computer to be unable to perform the operation.
difficult to detect
d. Linker
When executable (.exe) file is not created. e.g.
using Main() instead of main().
e. Logical
when there is a mistake in calculation that leads to
wrong output. the calculation is executed by
computer without problem. is a user error.
One’s complement