Pointers and Arrays 1. Arrays : Arrays are data saved in a certain structure to be accessed as a group or individually. Some variables saved using the same name distinguish by their index. Array characteristics: – Homogenous : All elements is the same – Random Access How to write an array : type array_value [value_dim] ; example : int radit[20]; How to assign a value: • Example : A[6] = 30; A[3] = 909; this is an example of one dimensional array : #include<stdio.h> int SIZE = 12; void main() { int x, y; ...
Postingan
- Dapatkan link
- X
- Aplikasi Lainnya
ALGORITHM AND PROGRAMMING Program Control: Repetition 1. For : (exp1;exp2;exp3) statement; For or loop is used when, we want to do the same command input as before for a certain number of times. there are two types of loop: - infinite loop : usually appear when there are errors in the coding - nested loop : its a loop in a loop, the repetition will start from the inside. 2. While : while (exp) statements; For While, it is actually a condition where it checks the command input above it whether its true or false. it checks the condition before the program below it is executed. it will execute the command input until the condition is false. 3. Do-While do{statements};} while ...