An algorithm is an order of an enumeration of in resolving a fly in the ointment written out in in successive games in the base of a computer in order to make it easier for a job. Example, We will make a calculator summation: 1. Input first number 2. Input second number 3. Give the formula = first number + second number 4. Show the result 5. End Escape Sequences • \a bell, alert, system beep • \b back space • \t horizontal tab • \n new line, line feed • \v vertical tab • \r carriage return • \’ single quote • \” double quote • \\ backslash • \xdd hexadecimal notation • \ddd octal notation Output Operation • printf(); • putchar(); • putch(); • puts(); • etc. Output Formatting width : number of columns provided precision : digit number type : • d : signed decimal • o : unsigned octal • u : unsigned decimal • x : unsigned hexadecimal • f : floating point • e : floating point (exponent) • c : single character • s : string • % : % character • p : pointer for long type: long double -> ( “ %lf “) unsigned long int -> ( “ %lu “) long int -> ( “ %ld “) Input Operation • scanf(); • getchar(); • getch(); • getche(); • gets(); • etc. Pointer Pointer is a variable that store the address of another variable Pointer variable is a pointer that can be assigned with new value at run-time. Pointer constant is a pointer that can not be assigned with new value at run-time Array is Pointer Constant to its first element of the array. Array can be filled with pointer variable. Array 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 have similar data type Random Access = Each element can be reached individually, does not have to be sequential The definition consists of 4 components: • Type specified • Identifier (name of the array) • Operator index ([ ]) • Dimensional value inside operator [ ] String String is an array of character that ended with null character ( ‘\0’ or in ASCII = 0) String constant or string literal is some characters written between double quote Example: ”Hello Binusian 2022” Char Character in c written between single quote. Each uses one byte of computer memory Example: "h","a"

Komentar