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;
b= mysub (a);
printf ("b:%d\n",b);
a= mysub (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