forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help!, Whats wrong with my code?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
psiko_scweek



Joined: 12 Nov 2005
Posts: 42

PostPosted: Wed May 24, 2006 1:14 am    Post subject: Help!, Whats wrong with my code? Reply with quote

Code:

typedef struct{
int x, y;
}Objects;

Objects Robot[10];

Robot[1].x = 100;


Ive been trying to figure this out for about 2 days, ive looked on the net and it seems to be legit code, but i keep getting the error
Code:

main.c:58: error: syntax error before '.' token
make:  *** [main.o] Error 1


and i dont understand why.
Back to top
View user's profile Send private message Yahoo Messenger
fish



Joined: 08 Feb 2006
Posts: 25

PostPosted: Wed May 24, 2006 2:33 am    Post subject: Reply with quote

The assignment is outside of the main() function.
Back to top
View user's profile Send private message
psiko_scweek



Joined: 12 Nov 2005
Posts: 42

PostPosted: Wed May 24, 2006 3:42 am    Post subject: gotta be kidding me. Reply with quote

thats all my problem is?

thanks! ill try that when i get home from work.
Back to top
View user's profile Send private message Yahoo Messenger
CyberBill



Joined: 26 Jul 2005
Posts: 86
Location: Redmond, WA

PostPosted: Wed May 24, 2006 7:20 am    Post subject: Reply with quote

You're code should look more like:

Code:

typedef struct{
int x, y;
}Objects;

Objects Robot[10];

int main()
{
  Robot[0].x = 100;
  Robot[0].y = 100;
}


Remember that an array of size 10 is indexed 0 - 9, not 1 - 10.
Back to top
View user's profile Send private message AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group