LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-29-2006, 08:16 PM   #1
simasimon
Member
 
Registered: Mar 2006
Posts: 60

Rep: Reputation: 15
C newbie question


i have to program a n-in line game (hope you people know what i'm talking about)
anyway,
in order to print the game correctly each time a player plays, i will use a matrix that has a 0 if this space is empty, 1 if player one has a chip, an 2 if player two has a chip.

supposing i have defined my matrix like this in main
int matrix [] [5] = { {0,0,0,0,0} , {0,0,0,0,0} , {0,0,0,0,0} , {1,0,1,2,2} , {1,1,2,2,1} };

how would the protoype of my function print look like, ah how do i reference to each compnent of that matrix in order to know if i have to print an empty space, o one of the two kinds of chips?
 
Old 05-29-2006, 08:17 PM   #2
simasimon
Member
 
Registered: Mar 2006
Posts: 60

Original Poster
Rep: Reputation: 15
i know i have to pass the matrix the number of rows and columns, but i'm not sure about the syntaxis of the matrix
 
Old 05-29-2006, 09:47 PM   #3
simasimon
Member
 
Registered: Mar 2006
Posts: 60

Original Poster
Rep: Reputation: 15
closed
i solved the problem
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache newbie question.. (very newbie question) tarballed Linux - Newbie 1 02-07-2003 08:41 PM
RE: Suse 8.0 hardware question {newbie question, pls help} Radiouk Linux - Distributions 2 06-04-2002 12:53 PM
RE: Samba question pls help {Newbie question} Radiouk Linux - Networking 4 06-03-2002 06:40 PM
Security question {newbie question} Radio Linux - Security 3 05-17-2002 06:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration