C (programming language)
Data types:
int, long long, float, double
Conditions:
if (condition)
{
//if condition is true
}
else if (condition1)
{
//if condition is false but condition1 is true
}
else
{
// If conditions are false execute this
}
switch (variable)
{
case 1:
// if variable is 1
break;
case 2:
// if variable is 2
break;
default:
// if variable is something else
}
Boolean expressions:
- < – less then
- > – greater then
- <= – less or equal
- >= – greater or equal
- == – equal
- != – not equal
- || – OR
- && – AND
Loops:
for (initialization; condition; update)
{
//execute until condition is true
}
while (condition)
{
// execute while condition is true
}
do
{
// execute until condition is true
}
while (condition)
Function
<return type> <name> (<parameters>)
{
<code>
}
Leave a Reply
You must be logged in to post a comment.