Skip to content

Instantly share code, notes, and snippets.

@banan314
Created June 2, 2017 12:41
Show Gist options
  • Save banan314/bf8bce445f3b33117d473978fb53d6b8 to your computer and use it in GitHub Desktop.
Save banan314/bf8bce445f3b33117d473978fb53d6b8 to your computer and use it in GitHub Desktop.
send multiple characters using `COM_send`
#include <stdarg.h>
void COM_send_m(int n, ...) {
va_list send;
va_start(send, n);
while(n--)
COM_send(va_arg(send, char*));
va_end(send);
}
int main() {
char Z1 = 1;
COM_send_m(4, ':', Z1, !Z1, '#');
return 0;
}
@MaciejKolodziej
Copy link

--n jest szybsze ;p

@banan314
Copy link
Author

banan314 commented Jun 2, 2017

Tak, ale wtedy wykona się o 1 raz za mało 😄 (przy --n)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment