Prototying main
Name:
Anonymous
2012-01-12 15:38
#include <stdio.h>
int main ();
int main()
{
printf ("%s\n", "Hello World");
return 0;
}
Prototyping main ftw.
Name:
Anonymous
2012-01-12 15:40
Undefined behaviour. Toilet scrubber
Name:
Anonymous
2012-01-12 15:42
Genius.
Y no (int argc,char** argv)
Name:
Anonymous
2012-01-12 15:48
It's undefined behavior.
Name:
Anonymous
2012-01-12 15:51
PROTOTYPE MY ANUS
Name:
Anonymous
2012-01-12 15:54
You can't call it before it's declared:
#include <stdio.h>
int main();
void func1()
{
main(0, NULL);
}
int main(int argc, char **argv)
{
printf ("argc = %d\n", argc);
if (argc > 0)
{
func1();
}
return 0;
}
Name:
Anonymous
2012-01-12 15:55
ummmm no it's not undefined behaviour
the standard actually has a list of requirements if one wants to declare the main function
Name:
Anonymous
2012-01-12 15:55
>>6
I screwed up the prototype.
Name:
Anonymous
2012-01-12 15:57
>>6
That's incorrect you idiot. func1() one gets *both declared and defined*. Now why don't you just shut the fuck up and read one of the standards.
Name:
Anonymous
2012-01-12 16:00
Even gcc.c on GCC prototypes main.
Never call main, it's stupid, but prototype it, because it's cool. It's what the cool guys do.
Name:
Anonymous
2012-01-12 16:03
Prototype my dubs
Name:
Anonymous
2012-01-12 16:09
>>9
Its undefined. Read the standard.
Name:
Anonymous
2012-01-12 16:12
>>12
func1() is *above* main().
Name:
Anonymous
2012-01-12 16:16
>>13
Go back to /g/ you ignorant.
Name:
Anonymous
2012-01-12 16:17
>>13
read
>>8
he declared main (although it is wrong) before func1.
Name:
Anonymous
2012-01-12 16:20
>>15
I was referring to func1(). Not main().
Name:
Anonymous
2012-01-12 16:20
Name:
Anonymous
2012-01-12 16:35
>>9-16
Your kind doesn't belong here. Go back to /g/ mental midgets
Name:
Anonymous
2012-01-12 16:40
>>18
This, this and th-th-th-this.
Name:
Anonymous
2012-01-12 16:47
>>19
Actually, I was just kidding.
Name:
Anonymous
2012-01-12 17:27
>>1
printf ("%s\n", "Hello World");
back to /g/ with you
Name:
Anonymous
2012-01-12 17:42
>>21
Implying you didn't just come from /g/
Name:
Anonymous
2012-01-12 17:49
>>22
Back to /g/ with you, ``faggot''.
Name:
Anonymous
2012-01-12 18:12
Calling main recursively.
#include <stdio.h>
/* echo.c */
int main(int argc, char *argv[]);
int main(int argc, char *argv[]) {
if (argc == 1) {
printf("\n");
return 0;
} else {
printf("%s ", argv[1]);
return main(argc - 1, &argv[1]);
}
}
Name:
Anonymous
2012-01-12 18:32
Name:
Anonymous
2012-01-13 2:36
if __name__ == "__main__":
import python
Name:
Anonymous
2012-01-13 6:07
>>26
import python
fixed.