Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

boolean variable

Posted on 1998-12-01
4
Medium Priority
?
370 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 20 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
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 opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

610 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