Posts

Showing posts from October, 2018

Algorithm & Programming (Array and Pointer)

Algorithm & Programming (Array and Pointer) Pointer Pointer is variable that store address of another variable. Pointer which is mostly used : *(content of) and &(address of). Example: int i, *ptr; ptr = &i; To assign a new value to the variable pointed by the pointer: * ptr = 5;   / * means i=5 */   Pointer to pointer is pointer for address to another pointer. Pointer constant :  a pointer that can be assigned with new value at run-time. Array is pointer constant. Pointer variable :  a pointer that can not be assigned with new value at run-time. Array Array is data saved to be access as a group or individually. Characteristic: 1. Homogenous = all element have similar data type. 2.Random access = doesn't have to be sequential. Array Initialization Example : B[4]={1,2,5,} One Dimensional Array Syntax:   type array_value [value_dim] ; Example : int number[10000]; Two Dimensional Array Syntax : type name_arr...

Algorithm and Programming (Repetition)

Algorithm & Programming (Repetition) Repetion is instructions that is repeated in a certain amount of time Repetion : 1. For 2. While 3. Do while 1. FOR for (exp1, exp2, exp3){        statements; } exp1 : initialization exp2 : condition exp3 : increment or decrement 2. WHILE Statement will never be executed if the expression false while (exp) statements; 3. DO WHILE Expression done after executing the statements. Statement will be executed minimum once. do {        statements;       }while(exp); References: Paul Deitel & Harvey Deitel. (2016). C how to program : with an introduction to C++. 08. Pearson  Education. Hoboken. ISBN: 9780133976892. Chapter 3 & 4 Doing the Same Thing Over and Over: http:// aelinik.free.fr /c/ ch07.htm NIM=2201737412 Name=Samuel Xavier Wdjaja binus.ac.id skyconnectiva