Struct Char Array Problems
I am trying to put a char array into a struct but everything I have tried has not worked.
Code:
typedef struct{
int Grid_X;
int Grid_Y;
char Room_Name[30];
int North;
int South;
int East;
int West;
int Warp;
int Warp_X;
int Warp_Y;
int Chest;
}Room;
Room RG; //in main
char Name[30] = (*RG).Room_Name; //line 71
//In another function
void set_room_start(Room *RG){
(*RG).Grid_X = 0;
(*RG).Grid_Y = 0;
(*RG).Room_Name[30] = "Start Room"; //line 14
(*RG).North = 1;
(*RG).South = 1;
(*RG).East = 1;
(*RG).West = 1;
(*RG).Warp = 1;
(*RG).Warp_X = 5;
(*RG).Warp_Y = 0;
(*RG).Chest = 1;
}
That gives me warnings:
"14 E:\Code\Source Code\Game Commands.c [Warning] assignment makes integer from pointer without a cast"
"71 E:\Code\Source Code\Game Commands.c array initialized from non-constant array expression"
Could some one point out the mistake I am making in my struct code? Thanx in advance
RMDan
Edit:
For those who may be picky, Yes I did pas the address of RG to my functions.