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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:52:13+00:00 2026-06-06T05:52:13+00:00

As I know in C , passing of actual parameters of a function evaluation

  • 0

As I know in C, passing of actual parameters of a function evaluation starts from rightmost and directed to left.
What is the case for a macro definition with parameter? I made a code to make the sense clear but output confused me…
Here is the code.,

#define parsing(a,b) a*b

int parsefun(int a, int b)
{
    return a*b;    
}

int main()
{
    int i=10;
    printf("%d\n",parsing((i++),i));
    i=10;
    printf("%d\n",parsing(i,(i++)));
    i=10;

    printf("%d\n",parsefun((i++),i));
    i=10;
    printf("%d\n",parsefun(i,(i++)));
    system("PAUSE");
    return 0;
}

This code outputs,
100
100
100
110

I hoped same output for macros as function. But where is the crucial point here?

  • 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-06T05:52:15+00:00Added an answer on June 6, 2026 at 5:52 am

    parsing of actual parameters of a function starts from rightmost and directed to left

    I think you mean “evaluation” rather than “parsing”. But that’s not true, the C standard does not specify an order.

    So the behaviour you’re getting for the functions is unspecified by the C standard.

    I hoped same output for macros as function

    Macro arguments are not evaluated, they’re simply substituted. So you end up with this:

    int i=10;
    printf("%d\n", (i++) * i);
    i=10;
    printf("%d\n", i * (i++));
    

    After which, you’re simply seeing undefined behaviour, as explained in this question: Why are these constructs (using ++) undefined behavior?.

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

Sidebar

Related Questions

I know that when passing an object by value to a function, the move
I would like to know how could I use JSON for passing data from
I know when we are passing objects we are passing its reference as a
I know that when it comes to passing objects in java, the reference of
I want to know what the best practice is for passing values (sometimes multiple
I know for a matter of fact that Type cannot be used when passing
I am passing values from a form to a processing page. There are more
Is there a way to get the actual calling object from a method? For
Possible Duplicate: What is the safest way of passing arguments from server-side PHP to
Does anyone know what parsing or precedence decisions resulted in the warning 'Use of

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.