Wednesday, January 25, 2017

Learn C: Day by Day S:012517 - Current

22:37-1/25/2017
I took C class a year ago, now I'm taking assembly language class. It requires information from C as well. Now I need to review it.
https://en.wikibooks.org/wiki/C_Programming


Basic library or the header is 
#include <stdio.h>
Declare variables:
int var: integer
double
float
char: store single characters in ASCII by ' ' or store an array by "".
For storing a string we can write
const char string[] = "I'm declaring a string";
array
Array and String
array of integer
int array_number[];
array of character
char array_char[];
type name[number of elements]={comma-separated values}

FAQ:
  1. What is the differences between i++ and ++i
    i=1
    j=++i (notice that ++ is before i so i = 2, and j=2)
    k=i++ (notice that ++ is after i so k will keep the previous value of i, and i=2)
  2. What does += mean?
    for example
    c=10
    n=2
    c += n (will output 12, n + c and return value to c)