-
Do While Loop Error
Hi folks, I have set up the following program to read a series of keys from the keyboard, and then terminate the program. I do this by the use of a do while program that stops once the input reaches a numerical value '10'. This currently however, does not work correctly for me.
Can anyone tell me what I am doing wrong:
Code:
/* interface.c: The include functions designed to control the I/O of the PowerMath System */
#include <stdio.h>
mathInput()
{
int x=20;
int input;
char progInput[x];
do
{
x=1;
progInput[x]=getc( stdin );
progInput[x]=input;
x=x+1;
} while (input!=10);
}
int main()
{
mathInput();
return 0;
}
-
and where do you set any value to input variable?
-
Thanks,
the line
Code:
progInput[x]=input;
should have been
Code:
input=progInput[x];
.
I didnt realize that the two lines were different:)
-
-
The title of the thread at least ;)