Postingan

Menampilkan postingan dari Oktober, 2018

Algorithm and Programming-Array and Pointers

ALGORITHM AND PROGRAMMING ARRAY AND POINTERS We know that our computer has some way to address memory and store data for us, so we can abstract that away and program at a slightly higher level with C, using variables and arrays instead of memory addresses ourselves.We initialize an array of characters (which is exactly what a string is) to store the value that we extract from the string,  if we wanted to initialize that array of characters manually, we can do something like:... The 1st index of array starts from zero,so the last index is the number in initialization bracket minus 1.But if you want to input 3 characters,you must make at least 4 in the bracket of char of array,because the last index is always filled with '\0' char initials[4]; initials[0] = 'D'; initials[1] = 'J'; initials[2] = 'M'; initials[3] = '\0'; OR char initials[4] = {D,J,M}; Arrays can be used to store many of the same type of variable, but computer...

Algorithm And Programming-Repetition

ALGORITHM AND PROGRAMMING PROGRAM CONTROL-REPETITION (C Programming Language) What is Repetition? Basically,a repetition is one or more programs that are  repeated for a number of times which number can be defined first or defined later according to the condition.  So,there are 3 ways to do looping in C programming,which is for,while,dowhile,and for is the one that is predefined,meanwhile while's and dowhile's number is defined later Forever in C can be used like this: while ( true ) {      printf ( "hello, world \n " ); } Or... we can also use do while What is the difference?While vs do while? well for do while,we must "do" it first before checking the condition,so the loop will be executed at least once,meanwhile for while,we must check the condition before executing it even once. The while   keyword means that the loop will run as long as the Boolean expression inside the parentheses is true. And si...