
February 20th, 2013, 02:36 PM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 1
Time spent in forums: 22 m 59 sec
Reputation Power: 0
|
|
|
If loop conditions ignored
I am trying to use the response to a yes/no question to print one of two strings:
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int input;
printf ("Does this program work? Y/N:");
scanf("%i",input);
if ((input == 'y') || (input == 'Y'))
{
printf ("Success");
}
else
{
printf ("Error");
}
}
However, no matter what letter I put in, I get the "Error" result. I'm not sure what I'm doing wrong, so I'm seeing if anyone here can figure it out?
|