Question : scanf not working. VS2008

HI,

 I used VS2008 to create an empty project. I am trying to write a C program using that IDE. The getchar() command is not working. It just excutes that command and nothing happens. It doesnt prompt the user for a character at all. It just excutes that statement and value of c gets overwritten. Can someone please advice whats wrong?

Also can you please tell me a good IDE (besides Visual Studio) for writing c programs in windows that lets me step through the program as well.

Thanks
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
#include <stdio.h>
#include <ctype.h>
#define ASIZE 100

int main(void)
{
	int Array[ASIZE];
	
	int temp;
	int i=0,j=0;
	int count=0;
	char c = 'b';

	//***************************************************
	//read the array from the standard input 

	printf("Enter an interger for the array:\n");
	scanf("%d",&Array[count++]);
	printf("Do you want to continue\n");
	c = getchar();

	while (toupper(c) == 'Y')
	{
		printf("Enter an interger for the array.\n");
		scanf("%d",&Array[count++]);
		printf("Do you want to continue: Y:Yes and N:No \n");
		scanf("%c",&c);
	}

.... rest of the code

Answer : scanf not working. VS2008

>> Also try adding a space before the %c:
>>    scanf(" %c",&c);
Did you add the space?
Random Solutions  
 
programming4us programming4us