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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:03:54+00:00 2026-06-10T12:03:54+00:00

I have these two files: // first.c int main(void) { putint(3); } and //

  • 0

I have these two files:

// first.c
int main(void) {
  putint(3);
}

and

// second.c
#include <stdio.h>
void putint(int n) {
  printf("%d",n);
  getchar();
}

When I run gcc 4.6.1 under Win XP:

gcc first.c second.c -o program.exe

It has no problem and writes 3 to stdout. It doesn’t need putint declaration in first.c. How is this possible? Is this standard behavior?

I have tested this on MSVC 2008 Express and it runs only with the declaration as expected.

// first.c
void putint(int);
int main(void) {
  putint(3);
}

Solved, thanks for hints, these options helped to show the warning:

  • -Wimplicit
  • -std=c99 (MinGW 4.6 still uses gnu90 by default)
  • 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-10T12:03:55+00:00Added an answer on June 10, 2026 at 12:03 pm

    This is a legacy “feature” of C that should not be used as of several decades ago. You should use a compiler with settings that will warn you if you do something like this. Gcc has several switches that you should specify when using it & one of them will give you a warning for this.

    Edit: I haven’t been using gcc myself, but switches that you should check out are -pedantic, -Wall, -Wextra, and -std.

    The compiler that is accepting this is assuming, per the old language definition, that since you didn’t see fit to tell it otherwise, the function a) returns an int value and b) since you pass it an int (or if you passed it something that could be promoted to an int) the function expects that argument to be an int.

    As @veer correctly points out, this should generally work in your particular case. In other cases, however, differences between the implicit assumptions for a function without a prototype and the function’s actual signature would make things go boom.

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

Sidebar

Related Questions

I have two files: // event_test_delete.cpp #include <event.h> int main() { event_base* ev; ev
I have these two simple files that define a C++ class with a tryME
I have two excel files. Among many columns in both these files, they have
I have an ANSI C program comprising two files. The first file contains the
I have two simple programs that use named pipes, here is the first: int
Imagine I have two C# files. The first file, Class1.cs contains namespace CrossReferenceCheckingTest {
I have two files which both contain a list of words. Is there an
Say I have two files where there is one number per line File 1
Suppose i have one folder and inside that another two files are there .
I have these two lines in my web.xml <url-pattern>/</url-pattern> : Index Servlet and <url-pattern>/login</url-pattern>

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.