docs→rtfd
This commit is contained in:
parent
7bc781ed11
commit
c7ec1dc5d1
131 changed files with 1 additions and 1 deletions
104
rtfd/public/c/index.rst
Normal file
104
rtfd/public/c/index.rst
Normal file
|
@ -0,0 +1,104 @@
|
|||
c
|
||||
=
|
||||
|
||||
Imports
|
||||
-------
|
||||
|
||||
.. code:: c
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
Comments
|
||||
--------
|
||||
|
||||
.. code:: c
|
||||
|
||||
// single line comment
|
||||
/* multi line comment */
|
||||
|
||||
Constants
|
||||
---------
|
||||
|
||||
.. code:: c
|
||||
|
||||
#define NUMERIC_CONSTANT 123
|
||||
|
||||
Main
|
||||
----
|
||||
|
||||
.. code:: c
|
||||
|
||||
void main() {
|
||||
system("pause");
|
||||
}
|
||||
|
||||
Declarations
|
||||
------------
|
||||
|
||||
.. code:: c
|
||||
|
||||
// unsigned, sizeof()
|
||||
char c = '1';
|
||||
short s = 2;
|
||||
int i = 4;
|
||||
long l = 8;
|
||||
float f = (float)4;
|
||||
double d = (double)8;
|
||||
long double ld = (long double)16;
|
||||
|
||||
Output
|
||||
------
|
||||
|
||||
.. code:: c
|
||||
|
||||
printf("int: %d\n", entry1);
|
||||
printf("float: %.2f\n", f);
|
||||
|
||||
Input
|
||||
-----
|
||||
|
||||
.. code:: c
|
||||
|
||||
scanf("%d%s%d", &entry1, &operator, &entry2);
|
||||
|
||||
Conditions
|
||||
----------
|
||||
|
||||
.. code:: c
|
||||
|
||||
if (condition) {
|
||||
expression1;
|
||||
} else {
|
||||
expression2;
|
||||
}
|
||||
|
||||
.. code:: c
|
||||
|
||||
switch (operator) {
|
||||
case '+':
|
||||
expression1;
|
||||
break;
|
||||
default:
|
||||
printf("Nope!\n");
|
||||
}
|
||||
|
||||
Loops
|
||||
-----
|
||||
|
||||
.. code:: c
|
||||
|
||||
for (declarations;conditions;increments) {
|
||||
expression1;
|
||||
}
|
||||
|
||||
.. code:: c
|
||||
|
||||
while (condition) {
|
||||
expression1;
|
||||
}
|
||||
|
||||
.. code:: c
|
||||
|
||||
do {
|
||||
expression1;
|
||||
} while (condition);
|
Loading…
Add table
Add a link
Reference in a new issue