Solved

boolean variable

Posted on 1998-12-01
4
367 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

Independent Software Vendors: 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…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

733 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