![]() |
|
#1
|
|||
|
|||
Problem with comparing characterHello. I am trying to push in into a stack characters one by one from a char array. It is prompted to stop when an asterisks '*' char is read. But it doesnt seem to work that way for me. I am having problem with the part where i compare each char to '*' while(input[i] != '*'). I get no output from the program and it exits. Can someone help me with that. My program is bellow.
CPP / C++ / C Code:
Last edited by LuciWiz : 12-Nov-2009 at 08:28.
Reason: Please insert your C code between [cpp] & [/cpp] tags
|
|||
|
#2
|
|||
|
|||
Re: Problem with comparing characterWhat is your intention here?
CPP / C++ / C Code:
Also, you may want to put printf() statements throughout the code so that you can see the value of certain variables. For instance, it might be wise to print to the screen the user input that you read. |
|
#3
|
|||
|
|||
Re: Problem with comparing characterThat isn't part of the initial program. Just did that to see what i have in the stack after pushing the characters.
|
|
#4
|
|||
|
|||
Re: Problem with comparing characterI ran your program with printf() in it like so:
CPP / C++ / C Code:
This is the output: Code:
This is what I expected. Did you? |
Recent GIDBlog
Not selected for officer school by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Print Japaneese character on Linux terminal & debugging problem | rajeshgalla | C Programming Language | 1 | 17-Apr-2008 10:57 |
| Print Japaneese character on Linux terminal & debugging problem | rajeshgalla | C++ Forum | 0 | 14-Apr-2008 01:44 |
| Problem with character encoding | linkin | C++ Forum | 0 | 26-Mar-2007 22:21 |
| comparing multiple character arrays in C | alucard | C Programming Language | 4 | 03-Feb-2006 00:47 |
| Character Array problem | lyndonp | C++ Forum | 5 | 27-Jul-2005 21:19 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The