Didn't you read quzah's post?
Type: Posts; User: We'reGeeks
Didn't you read quzah's post?
Ok, finally got it.
Here's what I did:
int j;
for(j=0; !isempty(&X); j++)
{
if(j>0)
Hey I tried this:
while(!isempty(&X))
{
n1 = pop(&X);
*p = n1;
if(!isempty(&X)) //added this
p++;
I see. (Oh dear, I'm an idiot, lol)
Anyways, I don't know how to correctly terminate *p. Suggestions please....I thought that putting
*p = '\0'; would do it. :(
Ok whiteflags, I'll try that. Thanks for the advice.
If post is printed as "123*+34-" && we enter "123*+4-" as exp, it is safe to conclude that infix2postfix has no bug because it outputted a correct postfix expression. Now, when the program was used...
Ok, I still can't fix the problem. Help. T___T
@quzah: I think I terminated the string right. :|
I'd very much appreciate it if you could help. I really don't understand what's the problem. The infix2postfix and evaluate functions work fine I guess. So maybe it really has something to do with...
void infix2postfix(char* infix, char * postfix, int insertspace)
{
char *i,*p;
struct stack X;
char n1;
emptystack(&X);
i = &infix[0];
p = &postfix[0];
...
@anduril:
I'm using visual C++ 2005 express ed., it didn't have that kind of output.
Just this:
Ok, I tried erasing the & and the [], but it didn't make a difference. T___T
I'm very sorry. I'm really not good at asking questions.
I already did that. Look at my 1st post again. There in my main, you can see that I have printed the "post" array after calling the...
But why? For example, if I enter "1+2*3-4" as an infix expression and it gets converted into a postfix expression like so: "123*+4-", that gets stored into the "post" array. Now when I enter an...
I really don't understand.
int main()
{
char in[50],post[50], exp[50];
strcpy(&post[0],"");
printf("Enter Infix Expression : ");
I have a problem with implementing the evaluate function in main. When I let the user enter the postfix expression, it works. But if I just let it evaluate the postfix expression that was derived...
Thank you anduril and tabstop.
Do you mean do this:
void add(int s[],int elem,int *count)
{
@tabstop:
Oops, I didn't catch that part of the instruction. I guess I was only concerned with how to use the pointer parameter. Sorry. =/
void add(int s[],int elem,int *count, int cnt)...
@anduril & laserlight:
Here is a link to the instructions in my assignment: Instructions
@anduril:
How am I going to use pointers if I used your method? And I would not be following...
@laserlight: I'm trying to initialize a set. In my main function, I initialized both set 1 and set 2.
@anduril: I can't implement the function the way you said I should because this is a homework...
Header file:
void initialize(int s[], int *count);
void display(int s[], int count);
Implementation file:
Alright. You're right. I finally got it! Yay! Thanks much. ^^,
Why? When I ran my other C programs, I didn't have to specify their extension as ".c". They simply ran. =/
Also, there is only one error in the program I posted. =/
I keep getting this error (I'm using Visual C++ 2005 Express Edition by the way):
error C2440: '=' : cannot convert from 'void *' to 'ListNodePtr'
/* Operating and maintaining a list */...
Thanks! :)