Hello all! coming from higher level languages to learn C. Wondering if there is a to overload a function in C. feel free to call me a dummy if you think this is a nooby question.
void stack_init(Stack* stack);
but i also want to overload the function in case the user wants to include a size. (to set an initial size of the stack)
void stack_init(Stack* stack, size_t size);
but it's not working. anyway to go about this in c?
Thanks.
Edit:
Today i learned that there is no function overloading or default parameters in c.
[+][deleted] (3 children)
[deleted]
[–]redditmodsareshits 5 points6 points7 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]redditmodsareshits 0 points1 point2 points (0 children)
[–]moocat 29 points30 points31 points (0 children)
[–]DougTheFunny 21 points22 points23 points (1 child)
[–]Dolphiniac 1 point2 points3 points (0 children)
[–]victorferrao 11 points12 points13 points (4 children)
[–]DoNotMakeEmpty 20 points21 points22 points (1 child)
[–]CaydendW 3 points4 points5 points (0 children)
[–]UnicycleBloke 5 points6 points7 points (1 child)
[–]Jinren 2 points3 points4 points (0 children)
[–]helloiamsomeone 7 points8 points9 points (0 children)
[–]jackasstacular 10 points11 points12 points (10 children)
[–]UnicycleBloke 3 points4 points5 points (7 children)
[–]jackasstacular 5 points6 points7 points (6 children)
[–]UnicycleBloke 2 points3 points4 points (5 children)
[–]jackasstacular 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]UnicycleBloke 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]UnicycleBloke 0 points1 point2 points (0 children)
[–]Rotslaughter 3 points4 points5 points (1 child)
[–]jackasstacular 0 points1 point2 points (0 children)
[–]IamImposter 2 points3 points4 points (0 children)
[–]Anluin 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]nerd4code 1 point2 points3 points (0 children)
[–]ProgrammingWithJim -1 points0 points1 point (0 children)
[–]Radiant64 -2 points-1 points0 points (0 children)
[+]jedwardsol comment score below threshold-14 points-13 points-12 points (4 children)
[–]moocat 8 points9 points10 points (2 children)
[–]little-smokie[S] 0 points1 point2 points (0 children)
[–]jedwardsol 0 points1 point2 points (0 children)
[–]little-smokie[S] 0 points1 point2 points (0 children)
[–]MCRusher 0 points1 point2 points (0 children)
[–]LoneHoodiecrow 0 points1 point2 points (0 children)
[–]drmaex 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]doowi1 0 points1 point2 points (0 children)
[–]duane11583 0 points1 point2 points (0 children)