0

Possible Duplicate:
“int main (vooid)”? How does that work?

main(a,b,c)
{
    a=1;
    b=2;
    c=3;
    printf("%d %d %d",a,b,c);
}

How three Integer arguments a,b,c are possible inside main, as we know that the second formal parameter has to be a pointer to a pointer to a character?

Community
  • 1
  • 1

3 Answers3

3

Argument parameters are implicitly int, unless you specify otherwise.

main is only required to be main(void) or main(int, char **) on a hosted platform (i.e., running under an OS, basically). In a freestanding implementation, the prototype for main is implementation-defined.

Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680
0

This syntax is deprecated in C. Just don't use it

Armen Tsirunyan
  • 130,161
  • 59
  • 324
  • 434
-2

a) pointers are (almost always) ints
b) some environments, including windows allow three parameters.

edit: Recognised pointers are not always ints.

Marcin
  • 48,559
  • 18
  • 128
  • 201
  • 1
    No they are not ints, they can be ints, but most definately do not have to be. – wich Feb 23 '11 at 14:21
  • 3
    @wich: I'll take it even further. They are *never* ints, they just may be the same size as ints. – Oliver Charlesworth Feb 23 '11 at 14:25
  • What's the difference between being an int, and being indistinguishable from an int? This isn't a high-level language where all representations are numinous. – Marcin Feb 23 '11 at 14:27
  • @Marcin: Saying that "a pointer is normally an int" is as meaningful as saying "a float is normally an int". – Oliver Charlesworth Feb 23 '11 at 15:14
  • @Oli Charlesworth: A specious analogy if ever I saw one. The behaviour of float and int under arithmetic operations is different, even if their length is the same. By contrast, casting a pointer to an int (assuming they are the same length), and performing arithmetic will result in exactly the same results as if no cast had occurred. – Marcin Feb 23 '11 at 15:18
  • @Marcin: Firstly, that's not entirely true (although I accept the point you're trying to make!). Secondly, why not simply rephrase your answer *correctly*: "Pointers are (almost always) the same size as ints"? Then everybody would be happy (apart from people disputing the claim that they're almost always the same size...) – Oliver Charlesworth Feb 23 '11 at 15:20
  • @Oli Charlesworth: Because my point is that there is almost no scope for borkage to occur by declaring pointer parameters as ints (except the obvious that you forget what you're pointing to). – Marcin Feb 23 '11 at 15:27