Solved

boolean variable

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
logging Access violation 6 18
Is string constant address ? 10 189
Test against App 49 129
Intel debugger, idb, only seeing .c and .h, but no .f90 1 260
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…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
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.

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now