Created
August 18, 2022 15:18
-
-
Save midnqp/05734f30a622c4c2b8e98c6062fa2e61 to your computer and use it in GitHub Desktop.
C/C++ code using libcpy.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cpy.h> | |
int main() { | |
char* name = new(Str_t); | |
List* ls = new(List_t); | |
bool t = type(ls) == List_t; //true | |
double arr[] = { 1.2, -3.4 }; | |
input(name, "π¨π»βπ» Username: "); | |
listAdd(ls, 1.2, -3.4, name); | |
print(ls, name); | |
print("π₯ anything", -5.6, t, arr); | |
} | |
// Count variadic args | |
#define function(args...) ({ \ | |
int count = va_argc(args); \ | |
print("Count: ", count); \ | |
}) | |
function(0, 1, 2, 3); // Count: 4 | |
// Overload a function | |
void _add(int argc, unsigned short argv[], ...); | |
#define Add(args...) ({ va_argv(_add, args); }) | |
Add(1, 2, 3, 4, 5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment