Yes, I have debugged this whole code. But what do you mean why adding some debug?
Actually the runtime error here is that my postfix expression is showing only a single character.
This loop:
I don't think it does what you think it does.
Particularly this expression: ifx[i]!='\0',pfx[j]!='\0' Listing more than one in a row with commas doesn't do a logical and. It evaulates both statements, but only gives you the result of the second one! I think you must have meant (ifx[i]!='\0')&&(pfx[j]!='\0')
But that corrected expression still doesn't do what you think it does, because you're still assuming char arrays are strings. They're not exactly equivalent -- all strings may be char arrays, but that doesn't make all char arrays strings! NULLs don't just appear, something has to put them there.
With that in mind, let's look at your loop again:
At program start, the contents of your pfx[] array are {' ', '\0', ???????? } because you called strcopy on it. The ???????? elements could be anything since nothing's been assigned to them yet.
First loop, i=0,j=0. It finds 'a' in ifx, so sets pfx[0]=ifx[0] (which happens to be 'a'), then adds 1 to j (because of pfx[j++]=...), then goes back up the for-loop, which adds to j again because of ++j.
Second loop, i=1, j=2. It checks if pfx[2], aka ?, is NULL. By sheer coincidence, it is, so the for-loop's condition becomes false, breaking the loop.
Some thoughts.
1) Why are you checking the value of pfx in the for-loop? You're writing to pfx, you don't need to care what used to be in it.
2) Why are you adding ++j every single loop? Not every loop will add a char. You could end up setting pfx[0], then pfx[3], then pfx[5], which will either create a string full of garbage or a string that ends too soon (depending on the previous contents of pfx). Only increment j when you actually add anything to pfx. You're also adding extra to i in places.
3) Why are you checking for NULLs when you have no strings? Either just use the length you got from before, or make it a string. When you want a string, the cheap+easy way is to use string functions:
Last edited by Corona688; 04-15-2011 at 01:41 PM..
Hi
I am exactly according to this link
CentOS 6 - Apache httpd - Enable Userdir : Server World
I Enabled userDirectory
Server version: Apache/2.2.15
CentOS release 6.8 (Final)
But Iget this Error
Forbidden
You don't have permission to access /~mn/index.html on this server
Goal... (2 Replies)
Hello,
I have some Fortran code that is providing the following error:
At line 1165 of lapc_shells_2.f
Fortran runtime error: Insufficient data descriptors in format after reversion
Here are the lines just above and including 1165:
WRITE (*,"('ATTEMPTING TO READ PLATE... (1 Reply)
Hi all,
I am trying to install a .bin file for that it requires IBMJava2-AMD64-142-JRE-1.4.2-13.8.x86_64.rpm to be installed. I have installed this rpm but when i try to install .bin file, it complains that no JRE found. How to solve this. Thanks in advance!
#... (0 Replies)
Hi
while trying to run few scripts
/afs/ae.ge.com/informatica/ardw/dev/bin/cdw_ar_update_recvbal.sh
this script contains the below data
load_dir=/afs/ae.ge.com/informatica/ardw/dev/data
prog_dir=/afs/ae.ge.com/informatica/ardw/dev/bin
ctl_dir=/afs/ae.ge.com/informatica/ardw/dev/ctl... (1 Reply)
All,
I am getting this when i try to ran a program in HP unix.
Things i came across
1. i have a system HP-UNIX where this same exe is working.
2. We have set a new HP_UNIX with the same configration and copied the exe to the new system we are getting this error.
3. Only... (3 Replies)
My system did stay appears the error Run Time Library Error. What itīs? When the error appear, iīve to reboot my system and lost all I did. Is there the UNIX System problem? Please. I need help!!! (4 Replies)
My interprise use a UNIX mainform for a instrumentation process control. The control use the FOXBORO INVENSYS system and they donīt gonna solve the problem the run time error. The run time error happen without logic explication. When everything itīs run perfectely and happenly appears the run time... (1 Reply)