Skip to content

Instantly share code, notes, and snippets.

View jacobabrahamb4's full-sized avatar

Jacob Abraham jacobabrahamb4

View GitHub Profile
@jacobabrahamb4
jacobabrahamb4 / function_pointers.c
Created April 12, 2013 07:29
function_pointers
#include <stdio.h>
#include <stdlib.h>
typedef int* intPtr;
typedef float (*fPtr) (float, float);
float plus(float a, float b){return a+b;}
float minus(float a, float b){return a-b;}
float multiply(float a, float b){return a*b;}
float divide(float a, float b){return a/b;}
@jacobabrahamb4
jacobabrahamb4 / pointers_to_pointers_2.c
Created April 12, 2013 07:26
pointers_to_pointers_2
// taken from http://beej.us/guide/bgc/output/html/multipage/morestuff.html#pt2pt
#include <stdio.h>
#include <stdlib.h>
void get_string(int a, char **s)
{
printf("s in get_string is : %p\n", s);
switch(a)
{
case 0:
@jacobabrahamb4
jacobabrahamb4 / use_pointers_to_pointers.c
Created April 12, 2013 07:18
using pointers to pointers in c
//taken from http://stackoverflow.com/questions/894604/passing-dynamically-allocated-integer-arrays-in-c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ELEMENTS 5
/*