Timeline for Print numbers from 1 to 10
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 8, 2020 at 1:20 | comment | added | chux |
@ChrisBouchard argc (or i here), could be zero in 1) non-hosted environments 2) when a program is called with exec() and specifies 0.
|
|
Jul 23, 2016 at 19:34 | comment | added | ABcDexter | @MatthewRoh +1 for the +1 about that part :) | |
Jul 21, 2016 at 15:43 | comment | added | Chris Bouchard | @AshBurlaczenko In C, the first argument to main is the number of command line arguments (including the executable name itself). Since no additional arguments are passed, that count is 1. The second argument to main is the actual list of command line arguments, but that argument is ignored in this program. | |
Jul 21, 2016 at 13:50 | comment | added | Ash Burlaczenko | Sorry, I've not written C but assumed it's default value would be 0 as in every language I've used. | |
Jul 21, 2016 at 13:41 | comment | added | FryAmTheEggman |
@AshBurlaczenko By consensus we have agreed that programs may assume they will not be called with unnecessary input (in this case, no additional command line arguments, beyond the program itself). That means i here will always be 1 when this program is run. Did you mean something else?
|
|
Jul 21, 2016 at 13:39 | comment | added | xsot | @AshBurlaczenko What are you talking about? This is a standard technique in golfing to initialise an int to 1. You don't need to pass any command line arguments. In fact, doing so will cause the program to produce the wrong output. | |
Jul 21, 2016 at 13:27 | comment | added | Ash Burlaczenko | There's no mention of being able to pass in parameters to the function. | |
Jul 21, 2016 at 9:23 | history | answered | xsot | CC BY-SA 3.0 |