Skip to content

Instantly share code, notes, and snippets.

@reagent
reagent / .gitignore
Created March 18, 2013 17:45
Dynamic Array
*.o
main
*.dSYM
@reagent
reagent / .gitignore
Last active December 14, 2015 00:59
File parsing w/ linked list / array
array
list
*.o
*.dSYM
main
*.dSYM
@reagent
reagent / .gitignore
Last active December 13, 2015 22:59
Just puttin' it out there
main
*.dSYM
@reagent
reagent / dynamic.c
Created February 6, 2013 18:44
Dynamic header structs
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef struct Header {
char *key;
char *value;
} Header;
typedef struct Response {
@reagent
reagent / .gitignore
Last active December 11, 2015 03:58
Simple buffer library
main
*.o
#include <stdlib.h>
#include <string.h>
char *
str_upcase(char *source)
{
int i = 0;
int shift = 0;
char ch = '\0';
#include <stdlib.h>
#include <stdio.h>
int
main(int argc, char *argv[])
{
if (argc <= 1) {
printf("Error: You must supply a value\n");
return 1;
}
@reagent
reagent / 2p1s.c
Created November 6, 2012 13:42
2 pointers, 1 string
#include <stdio.h>
int
main (int argc, char *argv[])
{
char *name = "Patrick";
char *other = name;
printf("Name is: %s\n", name);
printf("Other is: %s\n", other);
int main(int argc, char *argv[])
{
int val = 5;
switch(val) {
case 0: do {
case 5:
printf("Got here, value is %d\n", val);
case 4:
printf("Got here, value is %d\n", val);