Order of operations question

This is a discussion on Order of operations question within the C++ Programming forums, part of the General Programming Boards category; Hey everybody, Just have a really basic quick question, do mathematical expressions in C or C++ follow the standard algebraic ...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    4

    Order of operations question

    Hey everybody,
    Just have a really basic quick question, do mathematical expressions in C or C++ follow the standard algebraic order of operations, or does the compiler process everything linearly as it reads it? For example, would a + b * c be read b times c plus a like it would normally, or a plus b times c like it's written? I'm sure this is really basic stuff, but any help would still be greatly appreciated.

  2. #2
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    the standard order of operations is applied
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    4
    Okay, thanks, that's exactly I needed to know.

  4. #4
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by GuitarNinja View Post
    Hey everybody,
    Just have a really basic quick question,
    The answer to which can be found in any introductory C++ text.

    Is Guy Montag burning books again?
    Last edited by medievalelks; 04-11-2009 at 06:30 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Numerical order with ifs question?
    By JDrake in forum C++ Programming
    Replies: 5
    Last Post: 11-04-2006, 12:29 PM
  2. Order of operations question
    By nicomp in forum C++ Programming
    Replies: 9
    Last Post: 09-20-2006, 07:18 PM
  3. Exam Question - Possible Mistake?
    By Richie T in forum C++ Programming
    Replies: 15
    Last Post: 05-08-2006, 03:44 PM
  4. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 02:57 PM
  5. Question involving using math operations...
    By Screwz Luse in forum C Programming
    Replies: 6
    Last Post: 12-04-2001, 04:20 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21