Home > Articles > Programming > C/C++

  • Print
  • + Share This
This chapter is from the book

Q&A

Q. If a short int can run out of room, why not always use long integers?

A. Both short integers and long integers will run out of room, but a long integer will do so with a much larger number. On most computers, a long integer takes up twice as much memory, which has become less of a concern because of the memory available on modern PCs.

Q. What happens if I assign a number with a decimal to an integer rather than a float or double? Consider the following line of code:

int rating = 5.4;

A. Some compilers issue a warning, but the assignment of a decimal value to an integer type is permitted in C++. The number is truncated into an integer, so the statement assigns the rating integer the value 5. The more precise information is lost in the assignment, so if you tried to assign rating to a float variable, it would still equal 5.

Q. Why should I bother using symbolic constants?

A. When a constant is used in several places in a program, a symbolic constant enables all the values to change simply by changing the constant's initialization. Symbolic constants also serve an explanatory purpose like comments. If a statement multiplies a number by 360, it's less easily understood than multiplying it by a constant named degreesInACircle that equals 360.

Q.Why did Jack Klugman have a 40-year feud with Norman Fell?

A. Klugman, the star of the TV shows Quincy M.E. and The Odd Couple, had a well-publicized long-running spat with Fell, the star of Three's Company and the landlord on The Graduate. No one seems to know the cause, but it did not end until Fell's death in 1998.

The movie reference site IMDb quotes Fell as saying, "I could have killed as Oscar. I would have been great as Quincy. I wouldn't have been so hammy. Klugman overacted every scene. You want the show to be good, pick me. You want a chain-smoking jackass who ruins any credibility for your project, I'll give you Klugman's number."

IMDb quotes Klugman as saying after Fell's funeral, "Best funeral I've ever been to. I've never laughed so hard in years. I had the time of my life."

The two actors, born in Philadelphia two years apart, bear some resemblance to each other and could have competed for the same roles over the decades they were acting in films and television. In reality, however, they were not enemies. As the blogger Tom Nawrocki found out in 2008, their feud was a shared joke they played on the media.

  • + Share This
  • 🔖 Save To Your Account