Gamestudio Links
Zorro Links
Newest Posts
MRC.c and WFO
by joe_kane. 01/10/26 23:58
BarOffset (default = 940 for daily bars?
by joe_kane. 01/10/26 23:46
NOMAX undeclared identifier.
by Petra. 01/09/26 21:12
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 01/07/26 15:14
Zorro locks DLL
by jcl. 01/07/26 13:33
zorro with ccxt?
by qin. 01/07/26 07:50
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (joe_kane, 1 invisible), 5,557 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joe_kane, Namitha_NN, Syndrela, agasior, mosfet
19189 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Global and local struct #111293
02/07/07 15:20
02/07/07 15:20
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline OP
Serious User
vlau  Offline OP
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Code:

struct SPOT { // defines a global struct type named "SPOT"
int x;
int y;
char name[10];
};
struct SPOT myspot;

function main()
{
video_mode = 7;
screen_color.blue = 1;

// Define a local struct
struct SPOT {
int x;
int y;
char name[10];
};
struct SPOT myspot;

myspot.x = 10; // **
myspot.y = 20; // **
}



In the above code, I've defined 2 structs with the same name,
one is global struct and the other is local struct, and it
compiles and run without problem. I can access the local struct
members with the line //** but is there anyway to access the global
struct members? If not, why not throw a warning message?

Thanks.

Re: Global and local struct [Re: vlau] #111294
02/07/07 15:56
02/07/07 15:56
Joined: Nov 2003
Posts: 108
Oklahoma, USA
FixxeR Offline
Member
FixxeR  Offline
Member

Joined: Nov 2003
Posts: 108
Oklahoma, USA
Unless I'm very much mistaken, there is no such thing as a local struct.

FixxeR


John Dies at the End - One of the best fictional stories online. Join the fight for Internet Freedom
Re: Global and local struct [Re: FixxeR] #111295
02/07/07 16:12
02/07/07 16:12
Joined: Sep 2003
Posts: 407
inside to my
er_willy Offline
Senior Member
er_willy  Offline
Senior Member

Joined: Sep 2003
Posts: 407
inside to my
I think equal. For the compiler is the same struc.

Re: Global and local struct [Re: er_willy] #111296
02/07/07 17:00
02/07/07 17:00
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline OP
Serious User
vlau  Offline OP
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Oh, maybe I'm doing a stupid thing.
Thank you both.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1