Skip to content
Advertisement

C program works on my Ubuntu VM terminal but not on school Linux server?

I have this C program that runs perfectly on my Ubuntu Virtual Machine but does not run at all(doesn’t prompt user for input, just finishes) on the school Linux server.

School Linux version: Linux 2.6.18-371.9.1.e15 x86_64

My Ubuntu VM version: Linux 3.16.0-33-generic x86_64

Here is the program:

JavaScript

Any idea why this is??

P.S. thanks to those who helped me with this program from an earlier question 🙂

Advertisement

Answer

You need to initially set conv, for example:

JavaScript

As far as it running perfectly on one machine and not at all on another, you just got lucky. conv does have a value, even if you don’t explicitly set it. On one machine, it was 0 and on the other it was something other than 0, hence the different behavior.

Another method would be to use a do while loop:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement