What happens in C++ when a number is converted from one data type to another data type that can store only smaller numbers?  Are there any potential consequences from this occuring?  If so, please give an example.

What will be an ideal response?


The value is said to be demoted.  Yes, there could be an adverse consequence.  For example, if the number 19.25 was assigned to a variable declared to be of the short or int data type, then the result stored would be only 19 since these data types can only store integers.  This implicit demotion can adversely affect the program's output.

Computer Science & Information Technology

You might also like to view...

Worms spread over network connections without any help from users

Indicate whether the statement is true or false.

Computer Science & Information Technology

When parentheses are nested, which set of parentheses is evaluated first in an arithmetic expression? _______.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

The most popular project management software is ____.

A: ACT B: Microsoft Office Project 2007 C: Open Workbench D: Project Solution

Computer Science & Information Technology

____________________ zones are created on the DNS server that will act as the authoritative name server for that zone.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology