Code not working (C++ Unions and structures) : No matter how many times I reformat this, I keep getting all kinds of errors. The end result will be a program that can save functions targeting motors in a telescope and set coordinates. Any help in explaining what I am doing wrong with this setup would be greatly appreciated. here is the code:

`//IDENTIFY RECEIVER OF MESSAGE / TYPE OF MESSAGE / VIEW ALL TO 1 DEVICE / VIEW SPECIFIC MESSAGE`
     #include "messaging.h"
     #include <string.h>
     #include <stdio.h>

    using namespace std;

    typedef struct MGR{
	mess_types messagetype;
	int DeviceID;
	union E{
		//why arte these underlined? 
		char INST[STRSIZE];
		int codes[NBRCODES];
		float coords[NBRCOORDS];
	} message;
    };// info;


    void messager(){
    MGR my_data;
    my_data.messagetype = INST;
	my_data.DeviceID = TECH1;
	strcpy(my_data.message.INST, "GO HOME");

	my_data.messagetype = CODES;
	my_data.DeviceID = MOTOR1;
	for (int nbr = 0; nbr < NBRCODES; nbr++){
		my_data.message.codes[nbr] = nbr;
		print_message(my_data);
	}
    }
    int print_message(MGR mydata){
	MGR noot;
	scanf("%s", &mydata);
	switch (mydata.messagetype){
	case INST:
		printf("Message to Device %d", noot.DeviceID);
		break;
	case CODES:
		printf("The setup codes for device %d are: \n", noot.DeviceID);
		for (int code = 0; code < NBRCODES + OFFSET; code++){
			printf("%4d\t", noot.message);
		}
			break;
	case COORDS:
		printf("The setup codes for device %d are: \n", noot.DeviceID);
		for (int code = 0; code < NBRCODES + OFFSET; code++){
			printf("%4d\t", noot.message);
		}
			break;
		}
		printf("%c", mydata.messagetype);
		return(0)
		}

		void Sendmessage(){
			printf("This program does not work... it is under construction...");
    } 


Just in case: here is the header file

    #include "sprint1.h"
    #include <string.h>
    #include <stdio.h>
    #define STRSIZE 50
    #define NBRCODES 200
    #define NBRCOORDS 200
    #define OFFSET 100
    #define FACTOR 50
    #define TECH1 123
    #define MOTOR1 4556
    void messager();
    int print_message(MGR mydata);
    void Sendmessage();
    enum mess_types {INST, CODES, COORDS};
