Skip to content

Instantly share code, notes, and snippets.

@Ericson2314
Last active February 25, 2022 21:40
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 Ericson2314/c7cbc9b48765dfb6376a72d316369fa6 to your computer and use it in GitHub Desktop.
Save Ericson2314/c7cbc9b48765dfb6376a72d316369fa6 to your computer and use it in GitHub Desktop.
Main, the right way
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
int fixed_main(
size_t argc,
char const (*const (* argv)[argc + 1])[])
{
for (size_t i = 0; i < argc; i++)
{
printf("%s\n", (*argv)[i]);
}
return EXIT_SUCCESS;
}
int main(int argc, char* argv[])
{
return fixed_main(argc, argv);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment