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>
}

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.