C
From SUNY Potsdam ACM
Template for Posting
Go to the bottom of the postings, and paste this snippet and edit to your liking.
== My Posting == Description <syntaxhighlight lang="c"> //Your code here </syntaxhighlight>
Default Parameter Values
This is something I've been working on for a while. When linking objects in C (the way that I like) passing an incorrect number of parameters or providing wrong type parameters results in segfaults. The goal is to add default values to function parameters much like python or C++. Here is a simple example of how this works. I will be expanding this later.
--ac
#include <stdio.h> int funcA( int a, int b, ... ){ return a+b; } #define funcA( a, ... ) funcA( a, ##__VA_ARGS__, 8 ) int main(void){ printf("%i\n", funcA(1)); }