Solved

boolean variable

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
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.

863 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

23 Experts available now in Live!

Get 1:1 Help Now