hi friendzz !!
here is my program giving warning (possible use of 'ch' before the defination in function ) and also not showing correct o/p plz if anyone can help me

#include<stdio.h>
#include<conio.h>
void main (void)
{
int j;
char ch;
for(j=1;j<=5;j++)
{
printf("enter characters from a to e\n");
{
while((ch==getche()) != 'd')
{
printf("\nsorry it is incorrect");
printf("\n\ttry again");
}
printf("\nthats it GAMEOVER!!!");
}
}
getch();
}

Recommended Answers

All 2 Replies

>while((ch==getche()) != 'd')
== is comparison, = is assignment.

while((ch==getche()) != 'd')

I see you like C operator ==, but it's equal test operator, not assignment (operator=).
You are trying to COMPARE ch with getche() returned value. But you never assign the value to ch.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.