Solved

boolean variable

Posted on 1998-12-01
4
368 Views
Last Modified: 2010-05-18
what are all the necessary variables i need to declare a
boolean  two demension array in c ?  
0
Comment
Question by:cecila
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Author Comment

by:cecila
ID: 1254770
Edited text of question
0
 
LVL 2

Accepted Solution

by:
trillo earned 10 total points
ID: 1254771
You can use:
#define DIMENSION_1   5
#define DIMENSION_2   5

bool SomeArray[DIMENSION_1][DIMENSION_2];
or
BOOL SomeArray[DIMENSION_1][DIMENSION_2];

depending on the compiler you use
0
 
LVL 11

Expert Comment

by:alexo
ID: 1254772
Unfortunately, bool is not available in C (only in C++) and BOOL is a synonim to int defined by including <windows.h>.

You'd probably save lots of space by using: char array[N][M];
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 1254773
Or if you want to save even more space:

char array[N][M/8+1]

and to reference it

result = (array[x][y/8] & (128>>y%8))>0;
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question