Skip to content

Instantly share code, notes, and snippets.

@Dyrand
Dyrand / main.c
Created October 18, 2025 01:53
Named function parameters with defaults in C
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
struct _sorter_arg_type{void *array;
int elem_count;
int elem_size;
int (*comp)(const void*, const void*);
bool is_descending;};
@Dyrand
Dyrand / RPNcalculator.cpp
Last active April 15, 2017 06:29
Takes RPN as input
#include <iostream>
#include <stack>
#include <map>
#include <functional>
int main() {
std::stack<double> values;
std::map<std::string,
std::function<double(const double& x, const double& y)> > oper{
{"+", [](const double& x, const double& y) { return x + y; }},
#include <iostream>
#include "oper_private.hpp"
int main()
{
Oper calc;
calc.import_operator("multiply","multiply");
calc("multiply",5,7);
}
#ifndef ADDDLL_EXPORTS
#define ADDDLL_API __declspec(dllexport)
#else
#define ADDDLL_API __declspec(dllimport)
#endif
#include <vector>
#ifdef __cplusplus
extern "C" {