Skip to content

Instantly share code, notes, and snippets.

@cslott
cslott / gist:4049808
Created November 10, 2012 04:01
Variables PHP - Week 1 Day 2
<?php
// Interger Variables
$firstIntegerVariable = 26;
$secondIntegerVariable = 13;
$thirdIntegerVariable = $firstIntegerVariable + $secondIntegerVariable;
// String Variable
$firstStringVariable = "This is a sentence with punctuation.";
@cslott
cslott / gist:4049683
Created November 10, 2012 03:04
Programming PHP - Week 1 Day 1 - Hello World
<?php
echo 'Hi, good ol\' world!';
?>
@cslott
cslott / gist:4049613
Created November 10, 2012 02:39
Returning Stuff - CFSE
int main (void)
{
int total = 5;
printf ("The total is: %d; then %d; then %d; then %d.", total, 6, total + 3, printf("1234567"));
return 0;
}
@cslott
cslott / gist:4043344
Created November 9, 2012 02:29
Creating Pointers - CSFE 8.4
unsigned short int total = 50250;
// unsigned short takes up "two bytes"
// 1100 0100 0100 1010 = 50250
//..
// 1000 - 1100 0100
// 1001 - 0100 1010
//..
@cslott
cslott / gist:4043341
Created November 9, 2012 02:28
Pointers again - CSFE 8.3
char my_char = 'a';
// somewhere we have: address of my_char 0110 0001 <-- 'a'
// ...
// 0111 - 0000 0101 <-- 5
// 1000 - 0110 0001 <-- 'a'
// 1001 - 1101 0011 <-- unrelated data
// ...
@cslott
cslott / gist:4035824
Created November 8, 2012 01:25
Pointers and Memory Addresses - CSFE 8.2
int main (void)
{
char address = "abc123";
printf(address);
return 0;
// 0100 0001 - 41 (upper case 'A')
// 0110 0001 - 61 (lower case 'a')