diff --git a/tutorial1.c b/tutorial1.c new file mode 100644 index 0000000..b98ccee --- /dev/null +++ b/tutorial1.c @@ -0,0 +1,16 @@ +// tutorial 1 : simple hello world +// write comments like this +/* +or you could write comments like this too +*/ + +#include + +int main(){ + printf("hello world\n"); + printf("byee world\n"); + // "\n" is a newline character + return 0; +} + +// HAPPY CODING !!! \ No newline at end of file diff --git a/tutorial2.c b/tutorial2.c new file mode 100644 index 0000000..6ba527d --- /dev/null +++ b/tutorial2.c @@ -0,0 +1,37 @@ +// tutorial 2 : vaiables +#include +// you can create vaiables this way +// global variables can be accessed thourught the entire program +int i = 12; +float pi = 3.14; +char a = 'g'; +// + +int main(){ + /* local variables can be used only + within the scope in which they are defined in + */ + int local_variable = 34; + char alphabet = 'g'; + + printf("local vaiables : \n"); + printf("%d, %c",local_variable, alphabet); // you can print vaibles this way + printf("global vaiables : \n"); + printf("%d, %f, %c",i, pi, a); // you can print vaibles this way + + /* + %d is for integers + %f is for float + %d is for double + %c is for char + %s is for string + */ + /* + char takes one byte + integers takes 4 bytes + float takes up 4 bytes + */ + return 0; +} + +// HAPPY CODING !!!! \ No newline at end of file