Hello to everyone! or should I say, "Hello World"?
I am new to C and new to this forum, and this is my first post.
I wrote a simple C program which I called: isitprime.c and generated isitprime.exe.
I can call this program isitprime.exe from the command line with an integer number and the program will tell me if the number is prime. For instance, if I do this in the command line:
isitprime 5
it will tell me that it is a prime number. Of course if the number is not prime it will say so.
Now, I am writing another C program which I will use to ask the user to enter an integer representing the maximum number of primes to check. Let me explain with an example since this is a bit confusing.
The new program is called: genprime.c and its corresponding genprime.exe.
I want to:
1 - Type: genprime 10000
2 - genprime sets a loop from 2 to 10000, skipping the even numbers.
3 - genprime needs to call isitprime n where n is the loop index. In other words, isitprime gets called from genprime.
The question is, how do I call from a C program, another C program passing a parameter from the caller to the target?
Thank you