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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:39:49+00:00 2026-05-29T08:39:49+00:00

#include <stdio.h> void main() { int x=5,y=6; printf(%d%d%d,x++,(y=x++),(x=y++)); } Can anyone please explain why

  • 0
#include <stdio.h>
void main()
{
int x=5,y=6;
printf("%d%d%d",x++,(y=x++),(x=y++));
}

Can anyone please explain why does this returns 766?

  • 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-29T08:39:49+00:00Added an answer on May 29, 2026 at 8:39 am

    First, if this question, in this format, was given on a beginner C programming course, the course/teacher is a bad one.

    The main problem here is that both ‘x’ and ‘y’ are modified several times before a sequence point, which is undefined behavior (C99/C11 6.5 §2). This is a severe bug, because anything can happen. Before the ++ mess is removed, there is no telling what this code does. Read this then read it again.

    Further, the order of evaluation of function arguments is unspecified behavior. (C99/C11 6.5.2.2 §10). That is, the compiler may evaluate them left-to-right or right-to-left, and we cannot know which order that applies. The compiler does not need to document this! But if you are lucky, it could be documented. You must then read the compiler documentation to see which order of evaluation that applies, before attempting to answer the question. Otherwise you must give two answers.

    Further, if this is code for a hosted system, such as a Windows PC, main is only allowed to return ‘int’ or this code won’t compile on a C compiler.

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

Sidebar

Related Questions

#include<stdio.h> void foo(int **arr) { arr[1][1]++; } main() { int arr[20][20]; printf(%d\n,arr[1][1]); foo((int**)arr); printf(%d\n,arr[1][1]);
#include<stdio.h> void function(int); int main() { int x; printf(Enter x:); scanf(%d, &x); function(x); return
I got this C code. #include <stdio.h> int main(void) { int n, d, i;
#include<stdio.h> #include<sys/types.h> #include<stdlib.h> int turn; int flag[2]; int main(void) { int pid,parent=1; printf(before vfork\n);
My C Program Code: #include <stdio.h> int main(void) { printf(Content-Type: text/plain;charset=us-ascii\n\n); printf(Hello world\n\n); return
#include<stdio.h> #include<signal.h> #include<stdlib.h> void handler(int signo) { printf(First statement); system(date); exit(EXIT_SUCCESS); } int main()
consider the code #include<stdio.h> int main(void) { char* a; scanf(%s,a);//&a and &a[0] give same
Here is my code: #include <stdio.h> int main(void) { FILE *fp; unsigned int i;
#include <string.h> #include <stdlib.h> #include <stdio.h> int main(void) { unsigned char *stole; unsigned char
i have the following code: #include <stdio.h> int main(void) { float a[4] __attribute__((aligned(0x1000))) =

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.