Skip to content

Instantly share code, notes, and snippets.

Ryan McGovern RayanZenner

  • United Kingdom
Block or report user

Report or block RayanZenner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View output.js
<!DOCTYPE html>
<html>
<head>
<style>
#map {
width: 100%;
height: 100%;
}
body, html {
height: 100%;
View convert_to_json.c
/*
* Takes CSV data as input and converts it to json
* In this case we're using earthquake data
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
// define the maximum amount of data
#define MAX 256
View pointer_arrays_2.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int arr[] = { 1, 2, 3, 4 };
int *ptr = arr;
int size_of_arr = sizeof(arr);
int size_of_ptr = sizeof(ptr);
@RayanZenner
RayanZenner / pointers_arrays.c
Created Oct 12, 2018
Explaining the similarities and differences between pointers and arrays
View pointers_arrays.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int arr[] = { 1, 2, 3, 4 };
int size_of_arr = sizeof(arr) / sizeof(int);
int *ptr = arr;
View ships_2.c
#include <stdio.h>
void go_south_east(int lat, int lon)
{
lat -= 1;
lon += 1;
}
int main()
{
int lat = 32;
@RayanZenner
RayanZenner / ship.c
Created Oct 11, 2018
A simple program to demonstrate pointers in C
View ship.c
/* This program takes a user supplied value
* to move a "ship" south east by that many steps.
*
* It's worth noting that we use * in our go_south_east
* function parameters. This is so we can updated the value
* at the address of the supplied arguments.
*/
#include <stdio.h>
View books_2.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define MAX_DATA 512
struct Book {
int id;
char title[MAX_DATA];
@RayanZenner
RayanZenner / books.c
Last active Oct 7, 2018
A simple program to test fwrite and fread functions in C
View books.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Define some limits
#define MAX_DATA 512
// Create a struct for books
struct Book {
int id;
View database.c
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
// The notes in this file are for my own understanding. They might be considered overkill for a normal program
// define constants for maximum data size and maximum rows
#define MAX_DATA 512
@RayanZenner
RayanZenner / struct_pointers.c
Last active Oct 3, 2018
Structs with pointers in C
View struct_pointers.c
/* This code is taken line for line from the book
* Learn C the Hard Way by Zed A Shaw
*/
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
/* Create a struct for a person type.
You can’t perform that action at this time.