Thread: Precedence: Basic Question

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    24

    Precedence: Basic Question

    Really quick: Can someone explain in the order in which to read this?

    printf("%d \n", 2 > !3 && 4 - 1 != 5 || 6);

    Thanks!

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    C Precedence Table

    I'd whack a few brackets in though.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    24
    Thanks for the quick response but what would be printed?
    I just need someone to confirm that I'm using the precedence rules correctly.

    printf("%d \n", 2 > !3 && 4 - 1 != 5 || 6);

    2 > 0 && 3 != 5 || 6
    1 && 1 || 6 ??
    1 || 6?

    so the output is "1"?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A basic math programming question
    By hebali in forum C Programming
    Replies: 38
    Last Post: 02-25-2008, 04:18 PM
  2. Basic question about GSL ODE func RK4
    By cosmich in forum Game Programming
    Replies: 1
    Last Post: 05-07-2007, 02:27 AM
  3. Basic question about RK4
    By cosmich in forum C++ Programming
    Replies: 0
    Last Post: 05-07-2007, 02:24 AM
  4. A very basic question
    By AshFooYoung in forum C Programming
    Replies: 8
    Last Post: 10-07-2001, 03:37 PM