Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7681099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:15:55+00:00 2026-05-31T18:15:55+00:00

Which conversions take place when evaluating the following expressions? char cval; int ival; float

  • 0

Which conversions take place when evaluating the following expressions?

char cval;
int ival;
float fval; 
// Assume all 3 have been set to correct values...
a) if(fval)
b) double dval = fval + ival; 
c) dval + ival + cval;

My thoughts:

a) I assume if needs a bool value, so the float gets implicitly casted to bool.

b) I assume that fval is promoted to double and ival is converted to a double, and then they are added.

c) First, ival is converted to a double. Then dval + ival gets evalutated, which is of type double. Then cval…I don’t know if it gets converted to double directly, or if it it is promoted to int first. Anyway, after that step the temp value dval + ival is added to that double.

Is my understanding correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:15:56+00:00Added an answer on May 31, 2026 at 6:15 pm

    a) fval is contextually converted to bool.


    In cases b and c, the “usual arithmetic conversions” apply, meaning:

    b) ival is converted to float and (using a special rule, rather than the “usual arithmetic conversions“) fval + ival is converted to double.

    c) ival is converted to double, cval is converted to double.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a library which will take in two regular expressions and determine whether
Which of the following has the best performance? I have seen method two implemented
I was recently asked to take over a project in which waveform data is
I have a Java function which can take variable number of parameters and in
So I am attempting to write a compare function in C which can take
I've got a function which needs to take a UInt as a parameter. I'm
Here is my code which is doing the conversion from hex to decimal. The
here is my coding which gives me the error 'warning: unknown conversion type character
I'm writing a program which will use scan conversion on triangles to fill in
I am writing a library in standard C++ which does the phonetic conversion. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.