M
merrittr
I have been having troubles getting "string" input pushed on to the
stack in the assn1. The funny thing is
I can push a literal on no problem so
push("push i 0");
push("push i 1");
push("add");
works fine however
while(cVal != '\n') {
cString[iCharCount++] = tolower(cVal);
cVal=getchar();
}
cString[iCharCount++]='\0';
iCharCount=0;
push(cString);
doesn't work is there a diference between the literal text string and
the built string (char array null terminated?).
I have avoided scanf and gets`after reading the c programming FAQ.
here is the push code:
void push(char *p)
{
int ptr=iSp;
iItem[iSp++]=p;
print(*iItem);
}
stack in the assn1. The funny thing is
I can push a literal on no problem so
push("push i 0");
push("push i 1");
push("add");
works fine however
while(cVal != '\n') {
cString[iCharCount++] = tolower(cVal);
cVal=getchar();
}
cString[iCharCount++]='\0';
iCharCount=0;
push(cString);
doesn't work is there a diference between the literal text string and
the built string (char array null terminated?).
I have avoided scanf and gets`after reading the c programming FAQ.
here is the push code:
void push(char *p)
{
int ptr=iSp;
iItem[iSp++]=p;
print(*iItem);
}