The following code prints the argument passed to the function foo in every 5 second interval.
function foo(arg) {
console.log(arg);
}
setInterval(() => foo(5), 5000);
I found this answer: https://stackoverflow.com/a/43373364/13798537 that calls a function at periodic interval, but I couldn't figure out how to call a function at periodic interval that takes argument as shown in the javascript code.
Is there an equivalent to the javascript code in C++?
Thanks.