- Nov 6, 2004
- 324
- 0
- 0
Hi,
Yes, this is in regard to a class project, however, this portion is trivial, and not the purpose of the project. But, because I have been doing the rest of it for hours, I am fried and can't seem to make this part of it work. The project itself is a system simulation with discrete events, and I am trying to simulate the memory portion with a character array.
I have an array of characters, that is memory[] is a 256 element array that I'm using to simulate memory of 256 units. I'm not interested in string manipulation per se. Each element represents a memory cell, with character '_' denoting emtpy memory.
Anyway, I am trying to check if an element contains the character. I have been iterating through the array, and tried the comparison if (memory == '_') do this, etc. This never evaluates to be true, which is odd because the array is initialized to be filled with all '_' character. And it is as I've printed the array and seen this. So my question, how can I compare to characters? Please be merciful, I have been putting the rest of this thing together and am positively at a loss. What am I missing?
Thanks in advance.
Yes, this is in regard to a class project, however, this portion is trivial, and not the purpose of the project. But, because I have been doing the rest of it for hours, I am fried and can't seem to make this part of it work. The project itself is a system simulation with discrete events, and I am trying to simulate the memory portion with a character array.
I have an array of characters, that is memory[] is a 256 element array that I'm using to simulate memory of 256 units. I'm not interested in string manipulation per se. Each element represents a memory cell, with character '_' denoting emtpy memory.
Anyway, I am trying to check if an element contains the character. I have been iterating through the array, and tried the comparison if (memory == '_') do this, etc. This never evaluates to be true, which is odd because the array is initialized to be filled with all '_' character. And it is as I've printed the array and seen this. So my question, how can I compare to characters? Please be merciful, I have been putting the rest of this thing together and am positively at a loss. What am I missing?
Thanks in advance.
