paulchenpanther
Goto Top

Warum braucht Apples XCODE in main() Inhalte damit ein Programm läuft und Windows nicht ?

Hallo zusammen,

ich hänge mich momentan noch einmal ein bisschen an C und programmiere auf meinem Macbook mittels XCODE. Auf meinem Windows Rechner sah das Programm so aus, damit es funktioniert:

#include <stdio.h>

main() {



Bei Apple muss allerdings in main() was drin stehen, damit das Programm funktioniert :

#include <stdio.h>

main(int arg, const char * argv[ ]) {



Was ist das und wofür wird es bei Windows nicht benötigt ?

Content-Key: 178242

Url: https://administrator.de/contentid/178242

Printed on: April 24, 2024 at 01:04 o'clock

Member: Pjordorf
Pjordorf Jan 01, 2012 at 17:53:21 (UTC)
Goto Top
Hallo,

Zitat von @PaulchenPanther:
main(int arg, const char * argv[ ]) {
Was ist das
Liess mal The C Book. Und hier wird es ebenfalls ausführlich erläutert

Gruß,
Peter
Member: dog
dog Jan 01, 2012 at 23:34:50 (UTC)
Goto Top
Bei Apple muss allerdings in main() was drin stehen, damit das Programm funktioniert :

Das halte ich für ein Gerücht.

#include <stdio.h>

int main ()
{

	// insert code here...
	printf("Hello, World!\n");  
    return 0;
}

...kompiliert bei mir unter Xcode 4 ohne Fehler oder Warnungen.

Wofür das gut ist hat Peter ja schon geschrieben.