Discuss the development of new homebrew software, tools and libraries.
	Moderators: cheriff, TyRaNiD
			
		
		
			- 
				
																			 psiko_scweek
- Posts: 42
- Joined: Sat Nov 12, 2005 2:30 am
						
					
													
							
						
									
						Post
					
								by psiko_scweek » 
			
			
			
			
			Code: Select all
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: Select all
main.c:58: error: syntax error before '.' token
make:  *** [main.o] Error 1
and i dont understand why.
 
		 
				
		
		 
	 
				
		
		
			- 
				
																			 fish
- Posts: 25
- Joined: Wed Feb 08, 2006 5:12 am
						
					
						
		
													
							
						
									
						Post
					
								by fish » 
			
			
			
			
			The assignment is outside of the main() function.
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			- 
				
																			 psiko_scweek
- Posts: 42
- Joined: Sat Nov 12, 2005 2:30 am
						
					
													
							
						
									
						Post
					
								by psiko_scweek » 
			
			
			
			
			thats all my problem is?
thanks! ill try that when i get home from work.
			
			
									
									
						 
		 
				
		
		 
	 
				
		
		
			- 
				
																			 CyberBill
- Posts: 86
- Joined: Tue Jul 26, 2005 3:53 pm
- Location: Redmond, WA
						
					
						
		
													
							
						
									
						Post
					
								by CyberBill » 
			
			
			
			
			You're code should look more like:
Code: Select all
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.