Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 02/27/26 22:06
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (TipmyPip, Quad), 4,722 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 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