Intro to C

C is somewhat linked to awk but it goes C -> Unix -> awk

hello.c

 * 1) include  /* instructions to compiler to include stdio.h, .h means a header file, stdio is the standard input/output */


 * 1) include 


 * 1) include "junk.c" /* include file located in the current directory and run the code. More of a code transclusion*/

int main { /* every C program includes a main function */

printf("Hello World!\n");

return 0; /* need to return something */

}

Integers

 * byte
 * short
 * int
 * long

Floating point

 * float
 * double

Bool

 * bool

These ones are not standardized

Other Stuff
Need to learn how to use pointers

January 12th notes
Continuing with C, see

Pointers
View image to the right

* p gives the value at location p (p->1709->7)

p gives the value of the location (1709)

&p gives its own memory location (1712)

x gives 7

* x gives the value at location 7 (x->7->location(7))


 * only works if x is declared as a pointer

&x gives memory location of content (1709)

malloc
Make a n array

p = (int*)malloc(sizeof(int)*5)