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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:30:37+00:00 2026-05-17T01:30:37+00:00

Looking at the code: int i = 5; if (i = 0) { printf

  • 0

Looking at the code:

int i = 5;
if (i = 0)
{
  printf ("Got here\n");
}

What does the C standard have to say about what will get printed?
Or in more general terms does the assignment happen first or the comparison?

  • 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-17T01:30:37+00:00Added an answer on May 17, 2026 at 1:30 am

    §6.8.4 says that the syntax for an if selection statement is:

    if ( expression ) statement

    Further in this section, it mentions that if the expression compares unequal to 0, then statement is executed. The expression must therefore be evaluated before it can be compared to 0. i = 0 is an expression which evaluates to 0. For further reference, see §6.5 “Expressions” with regards to §6.5.16 “Assignment operators”, in particular note this excerpt:

    An assignment operator stores a value in the object designated by the left operand. An
    assignment expression has the value of the left operand after the assignment, but is not an lvalue.

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

Sidebar

Related Questions

I have a simple problem; Here is the code : #include<stdio.h> main(){ int input;
*(int *)CV = (int)0; I was looking at a C code and can't understand
How to make this subqueries to good-looking code? And I looking guides about SQL
I have been looking through code for the last 3 days, and the original
I was looking at this SO question and got to thinking about const ints
I got the following code: int nnames; String names[]; System.out.print(How many names are you
The following code: int z = 0; while(z < 4) { printf(iteration %d\n,z); sleep(1);
been looking in a dead gaze at my code and haven't got anywhere. the
I have got this code that reads an integer using scanf and checks if
Here's my current code , and here's my current output: This program will calculate

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.