Hallo Community.
Ich habe angefangen mit mal wieder in C reinzulesen.
Dazu folgender Code:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int x,y;
printf("\n\t1 . R E C H E N P R O G R A M M ");
printf("\nBitte x eingeben : ");
scanf("%i",&x);
printf("\nBitte y eingeben : ");
scanf("%y",&y);
printf("\n %i + %i ist %i",x,y,x+y);
system("PAUSE");
return 0;
}
Wenn Ich jetzt in Code::Blocks 2+1 rechne passiert folgendes:
Ich tippe 2+1, er rechnet:
2 + 4199324 = 4199326
in wxDev c++
2 + 2130567168 = 21305671
Komisch ist nur, das wenn Ich das ganze in C++ mache:
Code:
#include <iostream>
using namespace std;
int main()
{
int a,b;
cin >> a;
cin >> b;
cout << a + b << endl;
system("pause");
return 0;
}
Bekomme Ich bei 2+1 auch 3 raus.
Wieso gehts in C++, aber nicht in C ?
Es macht mich verrückt.
Über Antworten freue Ich mich.
Gruß
Compufreak
Daran liegt das Problem, toll das mir das jetzt erst auffällt -.-
scanf("%y",&y)
NO COMMENT !