Skip to content

Instantly share code, notes, and snippets.

View guyhughes's full-sized avatar

guy hughes guyhughes

  • /boot/efi/vmlinuz+0x0
View GitHub Profile
#include <stdlib.h>
#include <stdio.h>
struct car{
char make[30];
char model[30];
int year;
int mileage;
};
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct studentRecord
{
char lastName[100];
char firstName[100];
long studentId;
double mark;
};
@guyhughes
guyhughes / Likeable.java
Created February 18, 2016 18:36
ITI1121 2013 exam question 1, code implementation
interface Likeable {
void like();
int getLikes();
}
TAGS := .tags
OUT := out
DEBUG_CFLAGS:=-Wextra -Wall -Wshadow -Wno-strict-aliasing -Woverflow -Wno-unused-parameter -Wno-unused-variable -g -pipe -march=native
CFLAGS:= -pipe -O2 -march=native
.PHONY: default debug tags out_run
out_run: run
./$(OUT)
out:
$(CC) $(CFLAGS) *.c -o $(OUT)
debug:
public class Foo implements Cloneable {
static class Bar {
public int i;
public Bar() { }
}
static class Qux {
public int a[];
public int b;
public Qux() { }
}
@guyhughes
guyhughes / git-ls-branches-porcelain.sh
Last active July 17, 2024 00:43
list git branches porcelain
git branch --list -q | sed 's/[\*\ ]*//g'
import java.util.LinkedList;
public class Lucas {
public static int lucas(int n){
switch(n){
case 0:
return 2;
case 1:
return 1;
default:
if (n < 0)
@guyhughes
guyhughes / Makefile
Last active June 27, 2016 15:27
trig in cpp
trig: trig.cc
g++ -o trig trig.cc -Wall -Wextra -pipe -lm
/*
* Question 5
* All of these classes should be public and in their own file.
*/
class Shape {
protected double x,y;
public Shape(double x, double y){
this.x=x;
this.y=y;
}
#include <bits/wordsize.h>
#include <stdio.h>
#include <inttypes.h>
int main(void)
{
uint64_t f, b, q, *foo, *bar, *qux;
foo=&f, bar=&b, qux=&q;
printf("size of a pointer is %d bytes\n",__WORDSIZE/8);