Select language
Română
English
Français
Deutsch
Italiano
Español
Home
Languages ▾
CPP
C
CS
GO
JAVA
Python
Html
JS
CSS
PHP
Hard Lessons ▾
Hard Lesson 1
Hard Lesson 2
Hard Lesson 3
Hard Lesson 4
Hard Lesson 5
Hard Lesson 6
Hard Lesson 7
Hard Lesson 8
Hard Lesson 9
Hard Lesson 10
Hard Lesson 11
Hard Lesson 12
Compiler
Account
C
Example
#include
int main(void) { printf("Hello World!\n"); return 0; } OUTPUT: Hello World! //Output
Variables
- int - EX:100 - Size: 4 bytes - float - EX:5.67 - Size: 4 bytes - double - EX:5.678 - Size: 8 bytes - char - EX:'A' - Size: 1 byte - string - EX:"Hello" - Size: 24 bytes - bool - EX:true/false - Size: 1 byte - void - EX:void function - Size:0bytes - long - EX:1000000 - Size: 8 bytes - short - EX:100 - Size: 2 bytes
Input
int myNum; printf("Please enter a number: \n"); scanf("%d", &myNum); printf("The number you entered:"); printf("%d",myNum);
Output
int testInteger = 5; printf("Number = %d", testInteger); float f = 5.99; printf("Value = %f", f); short a = 0b1010110; int b = 02713; long c = 0X1DAB83; printf("a=%ho, b=%o, c=%lo\n", a, b, c); printf("a=%hd, b=%d, c=%ld\n", a, b, c); printf("a=%hx, b=%x, c=%lx\n", a, b, c); printf("a=%hX, b=%X, c=%lX\n", a, b, c);
Comments
// This is a basic comment. ////... This is also a basic comment Basic comments only comment the line they are placed on from // to the end. /* This is a comment for an entire code sequence. This code is NOT executed. */
Functions
Can be of all the types specified above (int,float,void,..) int Hello(int x,float y) { //code.. retrun
} In this case: -int: Return type -Hello: Function name -int x and float y: parameters Void functions don't return any value!