CrazyEngineers
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • radha gogia

    MemberSep 3, 2014

    this because the compiler automatically makes a turn-around ,i.e after it stops on a particular maximum limit of positive range,it again begins from the lowermost point.i.e
    for(i=1;;i++)
    {
    printf("%d",i);
    }
    so actually this is an infinte loop as value of int ranges from -32,768 to +32,767 ,so after it reaches the maximum,again it carries on with minimum value,hope u are clear
    Are you sure? This action cannot be undone.
    Cancel
  • anksingla

    MemberSep 3, 2014

    thanks radha..
    will it work same for the minimum value...
    Are you sure? This action cannot be undone.
    Cancel
  • anksingla

    MemberSep 3, 2014

    thanks radha..
    will it work same for the minimum value...
    Are you sure? This action cannot be undone.
    Cancel
  • radha gogia

    MemberSep 3, 2014

    radha gogia
    this because the compiler automatically makes a turn-around ,i.e after it stops on a particular maximum limit of positive range,it again begins from the lowermost point.i.e
    for(i=1;;i++)
    {
    printf("%d",i);
    }
    so actually this is an infinte loop as value of int ranges from -32,768 to +32,767 ,so after it reaches the maximum,again it carries on with minimum value,hope u are clear
    anksingla
    thanks radha..
    will it work same for the minimum value...
    yes u can continue ur loop starting from minimum or from maximum,it always goes in a chain
    Are you sure? This action cannot be undone.
    Cancel
  • pratap singh, upendra

    MemberSep 15, 2014

    Basically the decimal numbers present in the source code are internally converted to their binary equivalents(since a computer is a digital machine and can understand 1s and 0s only) before they are processed.

    During the processing, the binary sequences are incremented or decremented depending upon the logic implemented and if there occurs an overflow operation, this situation is dealt as per the binary laws. These laws may result in certain binary sequences whose decimal equivalents are negative numbers.

    When the program displays the output, it displays the decimal equivalent of the changed binary sequence(that is representing a negative number). In other words we get a negative number as output.

    For more information on this topic, try to learn binary addition and subtraction in the presence of overflow. The same concepts applies here.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register