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

  • Home
  • SEARCH
  • 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 8237983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:39:32+00:00 2026-06-07T19:39:32+00:00

Please explain me why it behaves differently. int main() { int p; p =

  • 0

Please explain me why it behaves differently.

  int main() {
    int p;
    p = (printf("stack"),printf("overflow"));
    printf("%d",p);
    return 0;
  }

This gives the output as stackoverflow8. However , if I remove the paranthesis , then :

p = printf("stack"),printf("overflow"); gives the output as stackoverflow5

  • 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-07T19:39:34+00:00Added an answer on June 7, 2026 at 7:39 pm

    The Comma Operator

    The comma operator has lower precedence than assignment (it has a lower precedence than any operator for that matter), so if you remove the parentheses the assignment takes place first and the result of the second expression is discarded. So…

    int a = 10, b = 20;
    int x = (a,b); // x == 20
    int y = a,b;   // y == 10
    // equivalent (in terms of assignment) to
    //int y = a;
    

    Note that the third line will cause an error as it is interpreted as a re-declaration of b, i.e.:

    int y = a;
    int b;
    

    I missed this at first, but it makes sense. It is no different than the initial declaration of a and b, and in this case the comma is not an operator, it is a separator.

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

Sidebar

Related Questions

Please explain why the following pieces of code behave differently. #include<stdio.h> int main(){ float
Please Explain the following code #include <iostream> using namespace std; int main() { const
Please explain this type signature : void (*signal(int signo, void *(func)(int)))(int)
Please explain what this task is about? Create a generic linked list class that
Can some one please explain why this loop never 'breaks' and goes on forever
Can someone please explain to me how this responsive approach works? This was done
Please explain to me how this JavaScript row works: <a href=javascript: onclick=document.location='AddItem.aspx?catid=<%# Eval(CollectionID)%>'>[edit items]</a>
Could someone please explain why the following snippet behaves as it does? l <-
Can somebody please explain the purpose of TempData in MVC. I understand it behaves
Please explain why sometimes return statement is not needed? Function has a return type,

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.