Re: Doubt



On Jul 31, 3:44 pm, Ian Collins <ian-n...@xxxxxxxxxxx> wrote:
Anarki wrote:
int main(a,b,c,d,e,f,g)
{
   printf("Size of a = %d\nSize of b =%d",sizeof(a),sizeof(b));
   return 0;
}

The above program perfectly compiles in cygwin using gcc

and my questions are

1.How does the compiler know what are the types of variables a, b, c,
d, e, f and g?? Where is its declaration?

It's assuming they are int.

2.I haven't included stdio.h yet the printf compiles.The compiler
doesn't complain about the requirement of function prototype, why?

It does.

gcc /tmp/x.c
/tmp/x.c: In function 'main':
/tmp/x.c:3: warning: incompatible implicit declaration of built-in
function 'printf'

--
Ian Collins.

y no warning for me! ok if at all it complains how does this program
link with the printf? Does it look in default include files/libs ??

By the way I use Cygwin(windows Xp) is there a way to redirect the
warning/errors to a text file. If so please tell me how
.



Relevant Pages

  • Re: Doubt
    ... doesn't complain about the requirement of function prototype, ... link with the printf? ...
    (comp.lang.c)
  • Re: Ghost 9.0 - warning
    ... My original post heading definitely said "Warning". ... Deleting history, any history, should NEVER delete files. ... That prompt specifically told you what the outcome would be, ... Then why do you complain? ...
    (microsoft.public.windowsxp.general)
  • Re: Id avoid this area tomorrow night if I could
    ... occasionally have a loud party. ... I felt more like I couldn't complain because it was such an infrequent ... occurrence and I had received advance warning, ... But Lesley, you have a good defense - your own party! ...
    (rec.pets.cats.anecdotes)
  • Re: BBC1 "strong language warning" IPP during "25th Hour)
    ... another bunch who complain about every warning and obsess about these IPP ... they did the same thing 60 mins into the drama Dirty War. ... occasional cutaways to BBC News for updates in dramas like this, ...
    (uk.media.tv.misc)
  • Re: [PATCH] Re: NAK new drivers without proper power management?
    ... has no suspend or resume support. ... so that users know who to complain to. ... It dumps stack with the warning to make it easier to see what ... it set a switch that will be used to trigger the warnings in the core. ...
    (Linux-Kernel)