Link to home
Start Free TrialLog in
Avatar of shilpi84
shilpi84

asked on

arrays

I am writing a program in which i need 2 have a space in a 2 dimensional integer array.how do i incoroprate a space in an integer array when space is a character?
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yev_sh
yev_sh

I don't exactly understand what do you mean by "have a space in a 2 dimensional integer array".

But if you want to insert a ' ' char to an integer array you can insert it's ascii value.
Or you can use Collection's array (uses objects) and insert space char as it is.
Avatar of shilpi84

ASKER

what i meant was that for example i have 2 enter the following array int a[4][4].the element of row 4 and column 1 is a space how do i enter space in this array.
1  4  15  7
8  10  2  11
14  3  6  13
12  9  5    
Let me see, you have a matrix of numbers 4x4, where the bottom  right number is a space?
(under 13, right to 5)
you can't just insert char of space into integer array.
What you can do.
I can give you 2 solution(using INT array):

1)tag the "cell" where you need this space to appear with another number you never use. (like
    0,-1,99 etc')
   and on your other array manipulations check for this tag.
2)store the ascii values of the numbers and not numbers them self, this way you can insert space.

What if i want 2 enter a 2 digit number for example 15 what would be the ascii value of 15?