Postingan

Menampilkan postingan dari Oktober, 2018

Array and Pointers (17 October 2018)

> Pointer = A variable that used to store another variable address.                    Syntax -> <type> *(name of the pointer) Example: #include<stdio.h> int main(){ int angka; int *angka2; int **angka3; int ***angka4; *angka2 = angka; **angka3 = *angka2; ***angka4 = **angka3; angka = 8; printf("%d", ***angka4); return 0; } The program will print 8. Example 2: #include<stdio.h> int main(){ int angka; int *angka2; int **angka3; int ***angka4; *angka2 = angka; **angka3 = *angka2; ***angka4 = **angka3; angka = 8; **angka3 = 10; printf("%d", angka); return 0; } The program will print 10, same with printf("%d", *angka2); and ("%d",***angka4); > Array = Used to save several same type of data and the data can be accessed from anywhere or randomly by user.                 Syntax = ...

Program Control : Repetition (10 October 2018)

Definition of Repetition    => 1 or more instruction repeated for certain amount of time.    => Number of repetition can be predefined or defined later when running the program. Repetition or Looping operation consist of : 1. For 2. While 3. Do - While For = Syntax : for(exp1; exp2; exp3) statement;                          or                          for(exp1; exp2; exp3){                                 statement1;                                 statement2;                          }      exp1 : initialization      exp2 : conditional      exp3 : ...