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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:19:28+00:00 2026-06-05T04:19:28+00:00

int x = 15 ; printf ( \n%d \t %d \t %d, x !=

  • 0
int x = 15 ;
printf ( "\n%d \t %d \t %d", x != 15, x = 20, x < 30 ) ;

The output of the code is 1 20 1 but I assume it should be 0 20 1 since 15 == 15…

I am facing a problem with the “x != 15” part

  • 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-06-05T04:19:29+00:00Added an answer on June 5, 2026 at 4:19 am

    In my experience, most lists of arguments are processed from the right to the left under most C / C++ compilers, even though the specification makes no statement about the required order of evaluation.

    With such an understanding of how many compilers work, your list of arguments would be evaluated like so

    printf ( "\n%d \t %d \t %d", x != 15, x = 20, x < 30 ) ;
    

    evaluates (possibly) in the order of

    x < 30  => 1
    x = 20 (assigns x to 20, returning 20) => 20
    x != 15 => 1 (because x is now 20)
    

    If this evaluation order holds for your compiler, then rearranging the arguments like so

    printf ( "\n%d \t %d \t %d", x < 30, x = 20, x != 15 ) ;
    

    should yeild

    1 20 0
    

    because the comparison x != 15 will occur before x is reassigned to 20.

    The lesson of this exercise is to generally avoid assignments in list constructs (things that look like “a, b, c, d”) or at least not to read assigned variables within the same list construct, as you cannot be assured of right to left or left to right evaluation (it’s compiler dependent).

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

Sidebar

Related Questions

class classe (){ public: int key; static void *funct(void *context){ printf(Output: %d, , key);
#include<stdio.h> int main() { printf(He %c llo,65); } Output: He A llo #include<stdio.h> int
Consider this code: void res(int a,int n) { printf(%d %d, ,a,n); } void main(void)
This code #include <stdio.h> #include <stdlib.h> #include <time.h> int main () { printf (First
What is wrong in this code even the printf is not working. but it's
#include<stdio.h> int main () { printf(%#04x,50); } Some one showed me above code and
Say you have a C code like this: #include <stdio.h> int main(){ printf("Hello, world!\n");
I am trying the following C code: int main() { printf(text1\n); fork(); printf(text2\n); return
I have the following code: int main() { char *sPPhrase[51]; /* Input */ printf(Enter
I'm a junior student in IT. I am facing a problem with the output

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.