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 600273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:35:17+00:00 2026-05-13T16:35:17+00:00

Hay Dear! i know that if statement is an expensive statement in c++. I

  • 0

Hay Dear!

i know that if statement is an expensive statement in c++. I remember that once my teacher said that if statement is an expensive statement in the sense of computer time.

Now we can do every thing by using if statement in c++ so this is very powerful statement in programming perspective but its expensive in computer time perspective.

i am a beginner and i am studying data structure course after introduction to c++ course.
my Question to you is

Is it better for me to use if statement extensivly?

  • 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-13T16:35:17+00:00Added an answer on May 13, 2026 at 4:35 pm

    I’m not sure how you can generalise that the if statement is expensive.

    If you have

    if ( true ) { ... }
    

    then this the if will most likele be optimised away by your compiler.

    If, on the other hand, you have..

    if ( veryConvolutedMethodTogGetAnswer() ) { .. }
    

    and the method veryConvolutedMethodTogGetAnswer() does lots of work then, you could argue tha this is an expensive if statement but not because of the if, but because of the work you’re doing in the decision making process.

    “if”‘s themselves are not usually “expensive” in terms of clock cycles.

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

Sidebar

Related Questions

Hay, I'm using django 1.2 and i want to know how to count rows
Hay, i was wondering how i would go about setting up django so that
Hay, i can't seem to find any regular expressions online to remove <h1></h1> tags
Hay, i can't seem to send emails using send_mail(), and I'm not sure why.
Hay guys I've programmed a very simple range finder. The user can only select
hay guys, i'm having all sorts of mod_rewirte trouble in snow leopard. Anyone know
Hay how can I convert 01 to 1 02 to 2 all the way
Hay, I'm working on a windows form application (C#) that connects to a sharepoint
hay, i have two textboxes i.e book_name and author and a button that save
Hay all, I have an if statement. How could I make this as short

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.