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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:19:02+00:00 2026-05-25T23:19:02+00:00

Here I have written my name in main argument declaration but still this program

  • 0

Here I have written my name in main argument declaration but still this program works and did not give any warning.

#include <stdio.h>
int main(Mr32) 
{
    printf("why this works?");
    return 0;
}

Whenever I write anything in place of mr32 , The code still works. I really don’t know why this is happening. As per C programming standard this is wrong, right?

Edit : I have tried -Wall but it does not give any warning.

I think here it should be error, because i am not doing as standard C function definition declaration

In c every function definition must follow this format

return-type function_name ( arg_type arg1, ..., arg_type argN ); 

This should also appy to main() right ..??

Okay -Wextra shows warning that mr32 is by default int.

Then why is the default type of any argument in main() an int?

  • 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-25T23:19:03+00:00Added an answer on May 25, 2026 at 11:19 pm

    In the K&R C definition a parameter without type defaults to int. Your code then corresponds to

    int main( int Mr32 ) {
        printf("why this works?");
        return 0;
    }
    

    Take a look at this answer for the details: C function syntax, parameter types declared after parameter list

    Update

    To summarize: in C89 K&R declarations are still supported

    • undeclared parameter types default to int

      void foo( param )
      

      defaults to

      void foo( int param )
      
    • unspecified return types default to int

      foo()
      

      defaults to

      int foo()
      

    Note

    Although this is supported I would never use it: code should be readable

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

Sidebar

Related Questions

I have written some code that works pretty well, but I have a strange
I have written a code in C which works fine for int but when
I have a random line generator program written in Python2, but I need to
This is a test program that I have written for a larger project that
Just wondering what little scripts/programs people here have written that helps one with his
Here's a snippet of code from a shell script I have written: for src
Here is my situation. I have written a WCF service which calls into one
I have in here an old web application written in ASP.Net 2.0 + AJAX.
Here's the thing: I have two applications, written in C++ and running on two
The system I work on here was written before .net 2.0 and didn't have

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.