News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

! NOT operator

Started by puredesi5, April 10, 2013, 04:46:51 AM

Previous topic - Next topic

puredesi5

According to C books,   ! operator should work but it doesn't. Without ! code    works fine. Am I missing something?
I get following error.
QuoteBuilding main.obj.
C:\Users\Ba\Documents\Pelles C Projects\T11\main.c(9): error #2001: Syntax error: expected '(' but found '!'.
C:\Users\Ba\Documents\Pelles C Projects\T11\main.c(10): error #2001: Syntax error: expected ')' but found '{'.
*** Error code: 1 ***
Done.

#include<stdio.h>

int main()
{
int mynumber;
printf (" Please enter a number \n");
scanf("%d",&mynumber);

if !(mynumber == 10 )
{
printf("Is equal  \n" );
printf("Closing program\n");
}
else
{
printf("Not equal\n");
printf("Closing program\n");
}
       
return 0;
}

CLR


puredesi5

Thnks! That worked. I really appreciate it.