0

When I try to execute my program with an argument, it only returns a single result, regardless of the argument. It worked as expected when I did not attempt to implement arguments.

The program and it's output

I'm just now learning C, and I've written a Collatz Conjecture evaluator to review the syntax I've learned. Other sources say to just add an argument in the main method and then execute a.out with your argument after. So far that hasn't worked as expected. Am I implementing arguments incorrectly? Is the body of the program itself erroneous?

Vendetta
  • 1
  • 1
  • 1
    provide text code in the OP not a link to an image ([mcve]) – depperm Jan 19 '23 at 16:17
  • 2
    Please post all code, input, and output as text, not a picture of text and not a link to a picture of text. – dbush Jan 19 '23 at 16:17
  • your [function signature for `main` is wrong](https://stackoverflow.com/questions/2108192/what-are-the-valid-signatures-for-cs-main-function). – yano Jan 19 '23 at 16:17
  • "Other sources say to just add an argument in..." Whatever these resources are, stay away from them. There are defined valid signatures for `main`. Don't just add 1 argument. – Gerhardh Jan 19 '23 at 16:18
  • The `main` function in C does not convert the arguments to your preferred types: it only works with strings. `int main(int argc, char *argv[]) {}` The first param is the number of arguments, the second is the array of argument strings. – Steven Frew Jan 19 '23 at 16:19

0 Answers0