Skip to content

Instantly share code, notes, and snippets.

@ehahehah
ehahehah / server.c
Last active December 31, 2016 12:19
Distribution code
//
// server.c
//
// Computer Science 50
// Problem Set 6
//
// feature test macro requirements
#define _GNU_SOURCE
#define _XOPEN_SOURCE 700
@ehahehah
ehahehah / ++.c
Last active May 29, 2016 17:57
Demonstrates the difference between prefix and suffix decrement operators.
/*
* Demonstrates difference between prefix and suffix decrement operators.
* From: http://stackoverflow.com/questions/4445706/post-increment-and-pre-increment-concept
*/
#include <cs50.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
/**
* copy.c
*
* Computer Science 50
* Problem Set 4
*
* Copies a BMP piece by piece, just because.
*/
#include <stdio.h>
#include <cs50.h>
#include <math.h>
#include <stdio.h>
int main(void)
{
int num_coins = 0;
float change_dollars;
do
{
/****************************************************************************
* speller.c
*
* Computer Science 50
* Problem Set 6
*
* Implements a spell-checker.
***************************************************************************/
#include <ctype.h>
#
# Makefile
#
# Computer Science 50
# Problem Set 6
#
# compiler to use
CC = clang
@ehahehah
ehahehah / gist:4f27c7423685f767e33f
Last active August 29, 2015 14:08
dictionary.h
/****************************************************************************
* dictionary.h
*
* Computer Science 50
* Problem Set 6
*
* Declares a dictionary's functionality.
***************************************************************************/
#ifndef DICTIONARY_H
@ehahehah
ehahehah / gist:7f69502f3097ad63bed5
Last active August 29, 2015 14:08
dictionary.c
/****************************************************************************
* dictionary.c
*
* Computer Science 50
* Problem Set 6
*
* Implements a dictionary's functionality.
***************************************************************************/
#include <stdbool.h>
@ehahehah
ehahehah / gist:fdb3129993d0dea6a51c
Last active August 29, 2015 14:08
questions.txt
0. A lung disease that is otherwise known as silicosis, it is caused by inhaling very fine ash or silica dust.
1. It provide measures of the resources used by the current process or its terminated and waited-for child processes.
2. 16
3. Passing them by reference would allow us access to each of the individual members of the struct.
4. The for loop executes each time (so long as) the EOF has not been read. It first checks if the character being read is alphabetical or an apostrophe. If it is, it appends the character to the corresponding index of the array "word" and increases the index by 1 so that the next character read can be stored in the next memory location of the array "word". If the character read is neither alphabetical nor an apostrophe, a while loop iterates over that word, character by character, until a non-alphanumerical character is read, setting the index to zero on every iteration so that the array "word" can begin storing the next alphabetical string. In the event that an apostrophe is
@ehahehah
ehahehah / gist:3eb11f6613ac90ed6242
Created October 18, 2014 13:47
Pset 5 recover Version 4
/**
* recover.c
*
* Computer Science 50
* Problem Set 5
*
* Recovers JPEGs from a forensic image.
*/
#include <stdio.h>