c cheat sheet (PDF)




File information


Title: ccp_cheat_sheet
Author: Jared Schiffman

This PDF 1.5 document has been generated by Adobe Illustrator CS3 / Mac OS X 10.4.8 Quartz PDFContext, and has been sent on pdf-archive.com on 16/06/2016 at 07:19, from IP address 99.64.x.x. The current document download page has been viewed 353 times.
File size: 180.08 KB (2 pages).
Privacy: public file










File preview


Computational Form
Jared Schiffman
Fall 2007

C/C++ Cheat Sheet (v1)
libraries
#include
#include
#include
#include
#include

<stdio.h>
<string.h>
<stdlib.h>
<math.h>
<time.h>

input and output functions
string related functions
memory allocation, rand, and other functions
math functions
time related functions

functions
returnType functionName( input1Type input1Name, input2Type input2Name, .... )
{
// do something
return value;

// value must be of type returnType

}

comments
// one line comments

this is a C++ style one line comment

/* multiple line
block comment */

this is a traditional C style comment

variable types
char
bool
int
float
void

holds a character, or a number from -128 to 127 (1 byte)
holds a boolean value, either true or false (1 byte)
hold an integer (a positive or negative number with NO decimal, 4 bytes)
holds a real number (a positive or negative number with a decimal, 4 bytes)
no type, raw binary data

conditionals
A
A
A
A
A
A

== B
!= B
<B
>B
<= B
>= B

if
if
if
if
if
if

A
A
A
A
A
A

is
is
is
is
is
is

equal to B, this is true; otherwise, it’s false
NOT equal to B, this is true; otherwise, it’s false
less than B, this is true; otherwise, it’s false
greater B, this is true; otherwise, it’s false
less than or equal to B, this is true; otherwise, it’s false
greater or equal to B, this is true; otherwise, it’s false

control flow
if ( conditional )
{
// do something
}

if ( conditional )
{
// do something
}
else
{
// do something else
}

while ( conditional )
{
// do something
}

placing “break;” inside a while loop
breaks out of the loop

for ( initialization; test; command )
{
// do something
}

“break;” and “continue;” can be
used within for loops as well with
identical effects

switch ( variable )
{
case value1:
// do something
break;
case value2:
// do something else
break;
default:
// do something by default
break;
}

this is equivalent to:

if ( conditional )
{
// do something
}
else if ( another_conditional )
{
// do something else
}
else
{
// do something as default
}

placing “continue;” inside a while
loop jumps to the start of the next
loop

if ( variable == value1 )
{
// do something
}
else if ( variable = value2 )
{
// do something else
}
else
{
// do something by default
}

this is equivalent to:
initialization;
while( test )
{
// do something
command;
}






Download c cheat sheet



c_cheat_sheet.pdf (PDF, 180.08 KB)


Download PDF







Share this file on social networks



     





Link to this page



Permanent link

Use the permanent link to the download page to share your document on Facebook, Twitter, LinkedIn, or directly with a contact by e-Mail, Messenger, Whatsapp, Line..




Short link

Use the short link to share your document on Twitter or by text message (SMS)




HTML Code

Copy the following HTML code to share your document on a Website or Blog




QR Code to this page


QR Code link to PDF file c_cheat_sheet.pdf






This file has been shared publicly by a user of PDF Archive.
Document ID: 0000387960.
Report illicit content