C Programming

COMPOUND RELATIONALS ( AND, NOT, OR, EOR )

NEGATION


	#include <stdio.h>

	main()
	{
		int flag = 0;
		if( ! flag ) {
			printf("The flag is not set.\n");
			flag = ! flag;
		}
		printf("The value of flag is %d\n", flag);
	}


	Sample Program Output
	The flag is not set.
	The value of flag is 1

The program tests to see if flag is not (!) set; equal to zero. It then prints the appropriate message, changes the state of flag; flag becomes equal to not flag; equal to 1. Finally the value of flag is printed.


©Copyright B Brown. 1984-1999. All rights reserved.