Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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 | chip programmers | 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