Add files via upload
This commit is contained in:
parent
11663e4c20
commit
fd60ec2ab3
16
tutorial1.c
Normal file
16
tutorial1.c
Normal file
@ -0,0 +1,16 @@
|
||||
// tutorial 1 : simple hello world
|
||||
// write comments like this
|
||||
/*
|
||||
or you could write comments like this too
|
||||
*/
|
||||
|
||||
#include<stdio.h>
|
||||
|
||||
int main(){
|
||||
printf("hello world\n");
|
||||
printf("byee world\n");
|
||||
// "\n" is a newline character
|
||||
return 0;
|
||||
}
|
||||
|
||||
// HAPPY CODING !!!
|
37
tutorial2.c
Normal file
37
tutorial2.c
Normal file
@ -0,0 +1,37 @@
|
||||
// tutorial 2 : vaiables
|
||||
#include<stdio.h>
|
||||
// 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 !!!!
|
Loading…
x
Reference in New Issue
Block a user