From fd60ec2ab33481945cbc103a3b58c364664f6dfb Mon Sep 17 00:00:00 2001 From: Venky-234 <77890305+Venky-234@users.noreply.github.com> Date: Thu, 21 Dec 2023 21:54:02 +0530 Subject: [PATCH] Add files via upload --- tutorial1.c | 16 ++++++++++++++++ tutorial2.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 tutorial1.c create mode 100644 tutorial2.c 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