C – Passing a variable amount of arguments to main

view story

http://stackoverflow.com – I’m not sure if this is the correct way to do this. See my code below. I want to be able to pass a list of arguments to main, which would then get stored in another array. So, I want to be about to start the program with at least 1 argument… or as many arguments as I like. I might set a max amount of arguments to 32. Eg. ./foo 3 Or ./foo 3 56 12 34 56 111 2222 33 #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int i; int numbersEntered[argc]; if (argc <= 1){ printf("Not enough arguments entered\n"); (HowTos)