Question

FOR C PROGRAMMING ONLY, please! I am confused how to do the following: "Before any function...

FOR C PROGRAMMING ONLY, please!

I am confused how to do the following:

"Before any function calls, declare the array variables as follows :

1. Data type char, playerOneBoard, dimensions 10 x 10, using global constants ROWS and COLS

2. Data type char, playerTwoBoard, dimensions 10 x 10, using global constants ROWS and COLS

.... "

I have no idea how this is supposed to look, please help!!! Thank you in advance!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

In order to define globals constants define them outside every function including main function. So you can define global constants after you define # directives like #include<stdio.h>.

Now if you want to define all these array globally, then define them outside of all functions just like we define constants.

So, below is the implementation.

#include<stdio.h>

const int ROWS = 10; //declaring global integer constants

const int COLS = 10;

char playerOneBoard[ROWS][COLS]; //global 2D array of type char

char playerTwoBoard[ROWS][COLS];

//Remaining part will be afterwards

main ()

{

}

Above is the format to be used. I hope you are clear now. Please comment for any clarification.

Add a comment
Know the answer?
Add Answer to:
FOR C PROGRAMMING ONLY, please! I am confused how to do the following: "Before any function...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT