Skip to content

Instantly share code, notes, and snippets.

@twslankard
Created January 10, 2011 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twslankard/773636 to your computer and use it in GitHub Desktop.
Save twslankard/773636 to your computer and use it in GitHub Desktop.
#include <cstdio>
template <std::size_t N>
void printArray(const int (&arr)[N]) {
for (int i = 0; i < N-1; i++) {
printf("%d, ", arr[i]);
}
printf("%d\n", arr[N-1]);
}
int main(void) {
int a[] = {1,2,3};
int b[] = {2,4,6,7,10};
printArray(a);
printArray(b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment