All pastes #2104493 Raw Edit

Mine

public c v1 · immutable
#2104493 ·published 2012-01-20 14:01 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>#include <math.h>/* Example worker using a string */static int worker( double *d_ptr, char *string ){    /* My first value is the double passed in from GAUSS */    double first = *d_ptr;        /* My second value is expected to be "sin" for sine, or "cos" for cosine */    if( strcasecmp( string, "sin" ) == 0 )    {        /* Replace my first value with its sine */        *d_ptr = sin( first );    }    else if( strcasecmp( string, "cos" ) == 0 )    {        /* Replace my first value with its cosine */        *d_ptr = cos( first );    }    else    {        /* Replace the string with the word "error" to clue the GAUSS program in */        string = "error";    }}/* exported wrapper, all double * arguments, calls the real** function with whatever data types it expects*/int caller(double *x, double *y){    return worker(x,(char *)y);}