1. ## Boolean function returns

Hello. I'm in an introductory computer science class and so far it's been okay. With our most recent project, we've been told to come up with a program that prompts the user for four integers that we will use for a PRNG. We have to use boolean function, and if-else statements to test that the input is correct. If at any point it is not, main () must end the program. I've been using the book a lot for help but it doesn't explain how I can use the Boolean's return value.
The teacher doesn't want us using code we haven't gone over in class yet, so I can't use anything more advanced than if-else and Boolean returns. The code I need help with is the following. When I compile it using Bloodshed Dev C++, it says I can't compare pointers and integers. If I can understand just this part, I will be able to finish rest. Thanks in advance.

Code:
```bool getInput(int* pSeed, int* pLb, int* pUb, int* pNumToGen)
{
getSeed(pSeed);

if (getSeed == true){
getBounds(pLb, pUb);
return true;
}

return false;
}

// function getSeed() prompts the user for a nonnegative integer
// and tests whether the input is valid.  If it is valid, the bool is set
// to true, if not, bool is set to false.  Finally it returns the bool value
// and sends the input as an output parameter.
bool getSeed(int* pSeed)
{
printf("Please enter a non-negative integer value: \n");
int seedResult = scanf("%d", &pSeed);

if(seedResult != 1){
printf("You have entered invalid data");
return false;
}

while (seedResult == 1){
if(&pSeed >= 0){
return true;
}
else{
printf("You have entered an invalid integer");
return false;
}
}

}```

2. Code:
```   if (getSeed == true){        // wrong.you meant getSeed(pseed) == true?

if(&pSeed >= 0){    // should be *pSeed```
When you use function name like getSeed, it's pointer to function.

3. Originally Posted by Bayint Naung
Code:
```   if (getSeed == true){        // wrong.you meant getSeed(pseed) == true?

if(&pSeed >= 0){    // should be *pSeed```
When you use function name like getSeed, it's pointer to function.
It's funny because I've tried this already and it does compile, but the program will crash when I enter input. "*pSeed" causes it to crash which makes no sense to me.

Thank you for the quick reply. I'm going to continue playing around with it and see if perhaps something else I did is causing the crash.

4. Can you post the code how you call getInput() function altogether with variable declaration that are passed to function.?
Btw, you should stop changing without any reason to make it work

5. Thanks again. This is the code. Trying to do the one subfunction correctly before I do the rest.

Code:
```/*   This program will prompt the user for a seed value, a lower bound value,
an upper bound value, and a quantity of pseudorandom numbers to generate.
If an input doesn't follow the criteria specified, an error message appears.
While generating the pseudorandom numbers it counts the number of even
numbers, the number of odd numbers, the number of negatives, the number of
positives, and the number of times 0 occurs.  Finally it displays the
original user inputs and the counts.
******************************************************************************/

/* preprocessing directives */
#include <stdio.h>
#include <stdbool.h>
#include <time.h>
#include <stdlib.h>
// Function Declarations
void displayName();
bool getInput(int* pSeed, int* pLb, int* pUb, int* pNumToGen);
bool getSeed(int* pSeed);
bool getBounds(int* pLb, int* pUb);
bool getNumToGen(int* pNumToGen);
void genRandom(int seed, int lb, int ub, int numToGen,
int* pEven, int* pOdd, int* pNeg, int* pPos, int* pZero);
void addToCounts(int randNum, int* pEven, int* pOdd,
int* pNeg, int* pPos, int* pZero);
void printResults(int seed, int lb, int ub, int numToGen,
int even, int odd, int neg, int pos, int zero);

// function main () calls displayName() then getInput().  Depending on the
// values inputted by the user, main() will decide whether to end the program
// or continue with the other functions.
int main (void)
{
bool testInput;
int aSeed, aLb, aUb, aNumToGen;
int aEven, aOdd, aNeg, aPos, aZero;

displayName ();
getInput(&aSeed, &aLb, &aUb, &aNumToGen);

return 0;
}

// function displayName() displays the programmer's name
void displayName()
{
printf("\nThomas Ciocco\n");

return;
}

bool getInput(int* pSeed, int* pLb, int* pUb, int* pNumToGen)
{

getSeed(pSeed);

if ((getSeed(pSeed)) == true){
getBounds(pLb, pUb);
return true;
}
getNumToGen(pNumToGen);

return false;
}

// function getSeed() prompts the user for a nonnegative integer
// and tests whether the input is valid.  If it is valid, the bool is set
// to true, if not, bool is set to false.  Finally it returns the bool value
// and sends the input as an output parameter.
bool getSeed(int* pSeed)
{
printf("Please enter a non-negative integer value: \n");
int seedResult = scanf("%d", &pSeed);

if(seedResult != 1){
printf("You have entered invalid data");
return false;
}

while (seedResult == 1){
if(pSeed >= 0){
return true;
}
else{
printf("You have entered an invalid integer");
return false;
}
}

}```

6. Code:
`      int seedResult = scanf("%d", &pSeed);    // since pSeed itself is pointer to int. just pass pSeed, not &pSeed.`

7. Thanks, I love you (no homo)

I would never have noticed this and I've been working on this project for many hours. I will play around with this.