Skip to content

Instantly share code, notes, and snippets.

@uucidl
Last active December 12, 2018 15:39
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 uucidl/5c0308f42d76cb2193a34a1e6ca10165 to your computer and use it in GitHub Desktop.
Save uucidl/5c0308f42d76cb2193a34a1e6ca10165 to your computer and use it in GitHub Desktop.
#include <stdio.h>
// Shows how to iterate backwards in C. (Counter version)
int main(int argc, char** argv)
{
{ int c = argc; while (c--) {
printf("%s%s", argv[c], c == 0 ? "\n" : ", ");
} }
}
include <stdio.h>
// Shows how to iterate backwards in C. (Ptr version)
int main(int argc, char** argv)
{
{ char** f = argv; char** c = f+argc; while (c-- != f) {
printf("%s%s", *c, c == f ? "\n" : ", ");
} }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment