Why Does it Work with Visual C++ but not with Miracle C?
Not what you're looking for?
In the following lines of code, the Miracle C compiler will not compile the line of code in the center (float x = 1/a;). Why does this occur? How can it be corrected?
int a = 3;
float x = 1/a;
printf("The value in x is: %f",x);
In some of the compilers the integer division returns an integer and hence cannot be stored in a float variable and to correct this you need to change the second line here with "float x=1.0/a;". Adding ".0" to 1 will make a difference.
_____________________________________________________________________
(My Question)
Doesn't the C language feature automatic conversion in mixed expressions? In a situation where you are converting integer to float, there is no loss of any numeric value as there would be in assigning a float to an int. So why would Miracle C block this but Visual C++ does not?
Purchase this Solution
Solution Summary
Some specific help on why Miracle C compiler does not allow some feature of C compilation.
Solution Preview
When it comes to implementation, different compilers (gcc, Turbo C, Borlan C, Visual C++) all adhere to the core standards of ANSI C. Some compiler have functions, implementations that ...
Purchase this Solution
Free BrainMass Quizzes
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.
Excel Introductory Quiz
This quiz tests your knowledge of basics of MS-Excel.
C++ Operators
This quiz tests a student's knowledge about C++ operators.
Basic Networking Questions
This quiz consists of some basic networking questions.
Word 2010: Table of Contents
Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.