myGully.com

myGully.com (https://mygully.com/index.php)
-   Programmierung (https://mygully.com/forumdisplay.php?f=67)
-   -   [C] Fehlermeldung in mein Programme .. ?? (https://mygully.com/showthread.php?t=2173576)

reda23 29.11.10 13:55

[C] Fehlermeldung in mein Programme .. ??
 
Hallo,

ich habe eine Programme in C geschrieben, aber kommt immer eine Fehlermeldung in meinem Compiler (DEV C++) :

PHP-Code:

#include<stdio.h>
void main (void)
{
int mysub (int x);
static 
int a=0;
a=a+x;
return (
a);
}
void main (void)
{
int mysub (int);
int a,b;
a=5;
bmysub (a);
printf ("b:%d\n",b);
amysub (b);
printf ("a:%d\n",a);


Die Ergebnisse muss so seien :

Ausgabe ohne "static": a= 5, b= 5
Ausgabe mit "static": a=10, b=5


Ich weiß nicht, wo liegt den Fehler.


Vielen Dank im Voraus

urga 29.11.10 18:54

du definierst 2x main(), 0x mysub() und behauptest es gäbe eine funktion mysub().

als compiler würde ich da auch meckern.
evntl so:

Code:

int mysub (int i) {
 return i*2;
}
int main() {
 // .....
 printf ("bla:%d\n",mysub(42));
 // ....
 return 0;
}



Alle Zeitangaben in WEZ +1. Es ist jetzt 10:07 Uhr.

Powered by vBulletin® (Deutsch)
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.