Hello,

I just recently started to learn C and i have a small question.
I wanted to use Flags to send to a function, but so far i havent been able to get them to work.

I have created a small command program in VS 2008. The only thing it prints out is Red, what am i missing?

Code:
#include "stdafx.h"

#define RED		0001
#define BLUE		0010
#define GREEN		0011
#define BLACK		0000
#define YELLOW		0100

void PrintData(char);

int _tmain(int argc, _TCHAR* argv[])
{
	int res;

	PrintData(RED | BLUE);


	scanf("%d", &res);
	return 0;
}

void PrintData(char mask)
{
	if ((RED & mask) == 1)
		printf("Red is used.\n");
	if ((BLUE & mask) == 1)
		printf("Blue is used.\n");
	if ((GREEN & mask) == 1)
		printf("Green is used.\n");
	if ((BLACK & mask) == 1)
		printf("Black is used.\n");
	if ((YELLOW & mask) == 1)
		printf("Yellow is used.\n");
}