Structs

So in class we just started Structs and for the most part they are not bad and I'm understanding it. However, my instructor throws me a curveball and want me to put a true false flay into the struct but unsure how to make this work correctly.

I know this is probably a lame post but please help

Assignment:

A. Define a struct that represents a CAT as follows:

A CAT has a weight, name, and a neutered flag, i.e., those are the components of the struct. Use a typedef

A. Make a single cat called max – assign its components to 12 (his weight), “Max”, FALSE (he is not neutered). Look at the cat in the debugger. (Use #define statements for TRUE and FALSE)



1
2
3
4
5
6
7
  #define TRUE 1
#define FALSE 0

typedef struct{
	char name;
	int weight;
} CAT;
This smells like C.

Do you know about booleans?
Topic archived. No new replies allowed.