diff --git a/c/c-tutorial/bitand.c b/c/c-tutorial/bitand.c new file mode 100644 index 0000000..31e5f8e --- /dev/null +++ b/c/c-tutorial/bitand.c @@ -0,0 +1,10 @@ +#include <stdio.h> + +int main() { + int x = 55; + printf("x = %d\n", x); + x = x & 7; + + printf("x = %d\n", x); + return 0; +} diff --git a/c/c-tutorial/bitops.c b/c/c-tutorial/bitops.c new file mode 100644 index 0000000..dc84b05 --- /dev/null +++ b/c/c-tutorial/bitops.c @@ -0,0 +1,59 @@ +#include <stdio.h> +#define BYTE unsigned char + +/* Funkton Bit_Test() + * val = der Wert, den es zu testen gilt + * bit = Bitnummer, die abgefragt wird ob gesetzt (0-7) + * + * R�ckgabewert = (1) = Bit gesetzt; (0) = Bit nicht gesetzt + */ + +int Bit_Test(BYTE val, BYTE bit) { + BYTE test_val = 0x01; + /* Bit an entsprechende Position schieben */ + test_val = (test_val << bit); + if ((val & test_val) == 0) { + return 0; + } else { + return 1; + } +} + +/* Funktion Bit_Set() + * val = Wert, bei dem Bit gesetzt werden soll + * bit = Bitnummer, die gesetzt werden soll (0-7) + * + * R�ckgabewert = keiner + */ + +void Bit_Set(BYTE *val, BYTE bit) { + BYTE test_val = 0x01; + /* Bit an entsprechende Position schieben */ + test_val = (test_val << bit); + *val = (*val | test_val); +} + +/* Funktion Bit_Clear() + * val = Wert, bei dem Bit gel�scht werden soll + * bit = Bitnummer, die gel�scht werden soll (07-7) + * + * R�ckgabewert = keiner + */ + +void Bit_Clear(BYTE *val, BYTE bit) { + BYTE test_val = 0x01; + /* Bit an entsprechende Position schieben */ + test_val = (test_val << bit); + *val = (*val & (~test_val)); +} + +int main() { + BYTE wert = 0; + printf("%s\n", Bit_Test(wert, 0)?"gesetzt":"nicht gesetzt"); + Bit_Set(&wert, 0); + printf("%s\n", Bit_Test(wert, 0)?"gesetzt":"nicht gesetzt"); + Bit_Clear(&wert, 0); + printf("%s\n", Bit_Test(wert, 0)?"gesetzt":"nicht gesetzt"); + + return 0; +} diff --git a/c/c-tutorial/char.c b/c/c-tutorial/char.c new file mode 100644 index 0000000..0d88e52 --- /dev/null +++ b/c/c-tutorial/char.c @@ -0,0 +1,23 @@ +#include <stdio.h> + +int main() { + char a = 'A'; + char b = 65; + int c = 65; + int d; + + printf("a = %c\n",a); + printf("b = %c\n",b); + printf("c = %c\n",c); + + d = a + b + c; + printf("d = %d\n",d); + + d = 'a' + 'A'; + printf("d = %d\n",d); + + printf("char a = %c und %d\n",a,a); + printf("char b = %c und %d\n",b,b); + printf("int c = %c und %d\n",c,c); + return 0; +} diff --git a/c/c-tutorial/comments.c b/c/c-tutorial/comments.c new file mode 100644 index 0000000..a8e4df1 --- /dev/null +++ b/c/c-tutorial/comments.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +int main () { + int i = 10; // Variable int mit dem Namen i und Wert 10 + printf("%d", i); // gibt die Zahl 10 aus + printf("\n"); // springt eine Zeile weiter + printf("10"); // gibt den String "10" aus + + return 0; + +/* Mehrzeiliger Kommentar */ +} diff --git a/c/c-tutorial/endlos.c b/c/c-tutorial/endlos.c new file mode 100644 index 0000000..d3165bb --- /dev/null +++ b/c/c-tutorial/endlos.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +int main() { + float i = 0.0; + + for(i = 0.0; i != 1.0; i+=0.1) { + printf("%f\n", i); + } + + return 0; +} diff --git a/c/c-tutorial/float.c b/c/c-tutorial/float.c new file mode 100644 index 0000000..978be4e --- /dev/null +++ b/c/c-tutorial/float.c @@ -0,0 +1,18 @@ +#include <stdio.h> +#include <float.h> +#include <limits.h> + +int main() { + printf("Limits und Eigenschaften des float-Wertes\n\n"); + printf("float ben�tigt %d Bytes (%d Bit) an Speicherplatz\n", sizeof(float), sizeof(float)*CHAR_BIT); + printf("Basis f�r Exponentendarstellung: %d\n",FLT_RADIX); + printf("Anzahl der Mantissenstellen : %d\n",FLT_MANT_DIG); + printf("Anzahl sign. Dezimalziffern : %d\n", FLT_DIG); + printf("Kleinst. neg. FLT_RADIX-Exponent: %d\n", FLT_MIN_EXP); + printf("Kleinst. neg. Zehnerexponent: %d\n", FLT_MIN_10_EXP); + printf("Gr�sster FLT_RADIX-Exponent : %d\n", FLT_MAX_EXP); + printf("Gr�sster Zehnerexponent : %d\n", FLT_MAX_10_EXP); + printf("Gr�sster endlicher float-Wert : %f\n",FLT_MAX); + printf("Kleinster endlicher float-Wert : %f\n", FLT_MIN); + return 0; +} diff --git a/c/c-tutorial/formatangaben.c b/c/c-tutorial/formatangaben.c new file mode 100644 index 0000000..8ca1e0c --- /dev/null +++ b/c/c-tutorial/formatangaben.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +int main() { + int i = 10; + printf("%5d\n",i); + printf("%*d\n",i,i); + return 0; +} diff --git a/c/c-tutorial/genauer.c b/c/c-tutorial/genauer.c new file mode 100644 index 0000000..60e37ed --- /dev/null +++ b/c/c-tutorial/genauer.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +int main() { + float f; + int i; + + f = 5.0; + i = 2; + + printf("%f\n", f/i); /* Ergebnis = 2.500000 */ + return 0; +} diff --git a/c/c-tutorial/hallo.c b/c/c-tutorial/hallo.c new file mode 100644 index 0000000..fb05989 --- /dev/null +++ b/c/c-tutorial/hallo.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main() { + printf("Hallo Welt\n"); + return 0; +} diff --git a/c/c-tutorial/hex2dec.h b/c/c-tutorial/hex2dec.h new file mode 100644 index 0000000..b6910d8 --- /dev/null +++ b/c/c-tutorial/hex2dec.h @@ -0,0 +1,10 @@ +#include <stdio.h> + +int main() { + char a; + + a = 0x0c; + + printf("Value is: %d\n", a); + return 0; +} diff --git a/c/c-tutorial/incr.c b/c/c-tutorial/incr.c new file mode 100644 index 0000000..721ee33 --- /dev/null +++ b/c/c-tutorial/incr.c @@ -0,0 +1,13 @@ +#include <stdio.h> + +int main() { + int i = 1; + + printf("i = %d\n", i); + i++; + printf("i = %d\n", i); + printf("i = %d\n", i++); + printf("i = %d\n", i); + printf("i = %d\n", ++i); + return 0; +} diff --git a/c/c-tutorial/int.c b/c/c-tutorial/int.c new file mode 100644 index 0000000..23a494c --- /dev/null +++ b/c/c-tutorial/int.c @@ -0,0 +1,8 @@ +#include <stdio.h> +#include <limits.h> + +int main() { + printf("int Gr�sso: %d Byte\n", sizeof(int)); + printf("Wertebereich von %d bis %d\n", INT_MIN, INT_MAX); + return 0; +} diff --git a/c/c-tutorial/iso-8859-1.c b/c/c-tutorial/iso-8859-1.c new file mode 100644 index 0000000..1f2ac31 --- /dev/null +++ b/c/c-tutorial/iso-8859-1.c @@ -0,0 +1,14 @@ +#include <stdio.h> + +int main() { + int i; + + for(i = 0; i < 254; i++) { + if (i == 26) { + continue; + } + printf(" |%d : %c| \n",i,i); + } + + return 0; +} diff --git a/c/c-tutorial/limits.c b/c/c-tutorial/limits.c new file mode 100644 index 0000000..e853c89 --- /dev/null +++ b/c/c-tutorial/limits.c @@ -0,0 +1,10 @@ +#include <stdio.h> +#include <limits.h> + +int main() { + printf("int-Wert mindestens: %d\n", INT_MIN); + printf("int-Wert maximal : %d\n", INT_MAX); + printf("unsigned int max. : %u\n", UINT_MAX); + printf("int ben�tigt %d Byte (%d Bit) Speicher\n", sizeof(int), sizeof(int)*CHAR_BIT); + return 0; +} diff --git a/c/c-tutorial/long.c b/c/c-tutorial/long.c new file mode 100644 index 0000000..0975884 --- /dev/null +++ b/c/c-tutorial/long.c @@ -0,0 +1,8 @@ +#include <stdio.h> +#include <limits.h> + +int main() { + printf("long Gr�sse: %d Byte\n", sizeof(long)); + printf("Wertebereich von %d bis %d\n", LONG_MAX, LONG_MAX); + return 0; +} diff --git a/c/c-tutorial/modulo.c b/c/c-tutorial/modulo.c new file mode 100644 index 0000000..ee093e1 --- /dev/null +++ b/c/c-tutorial/modulo.c @@ -0,0 +1,10 @@ +#include <stdio.h> + +int main() { + int x = 5; + int y = 2; + + x = x % y; + printf("Der REst von 5/2 = %d\n", x); /* Rest = 1 */ + return 0; +} diff --git a/c/c-tutorial/newline.c b/c/c-tutorial/newline.c new file mode 100644 index 0000000..cd3a623 --- /dev/null +++ b/c/c-tutorial/newline.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +int main() { + printf("Darstellung von Newline \n \n"); + + printf("M�gliche Ausf�hrung von Newline\n"); + printf("Mit hexadezimaler Angabe : \xa \xa"); + printf("Mit oktaler Wertangabe : \012 \012"); + printf("Mit dezimaler Angabe : 10 %c", 10); + printf("Hallo Ich bin nicht mehr lesbar\n"); + return 0; +} diff --git a/c/c-tutorial/operatoren.c b/c/c-tutorial/operatoren.c new file mode 100644 index 0000000..4e12ccf --- /dev/null +++ b/c/c-tutorial/operatoren.c @@ -0,0 +1,39 @@ +#include <stdio.h> + +int main() { + int zahl1, zahl2, zahl3; + int ergeb; + + zahl1 = 10; + zahl2 = 20; + zahl3 = 30; + + printf("Zahl 1 = %d\n", zahl1); + printf("Zahl 2 = %d\n", zahl2); + printf("Zahl 3 = %d\n", zahl3); + + /* M�glichkeit 1: zuerst Berechnung, dann Ausgabe */ + ergeb = zahl1 + zahl2 + zahl3; + printf("Summe aller Zahlen: %d\n", ergeb); + + /*M�glichkeit 2: wie oben, nur mit Ausgabe in einem Schritt */ + ergeb = zahl3 - zahl2; + printf("%d - %d = %d\n", zahl3 , zahl2, ergeb); + + /* M�glichkeit 3: mit Anzeige */ + /* und Berechnung am Ende der */ + /* 'printf'-Anweisung */ + printf("%d * %d = %d\n", zahl1, zahl1, zahl1 * zahl1); + + /* M�glichkeit 4: weitere 'printf'-Berechnung */ + printf("Zahl 3 / Zahl 1 = %d\n", zahl3 / zahl1); + + /* M�glichkeit 5: wieder eine mit 'printf' */ + printf("Zahl1 + x-Beliebige Zahl = %d\n", zahl1 + 11); + + /* Ein Klammerbeispiel */ + ergeb = (zahl1 + zahl2) / zahl3; + printf("(%d + %d) / %d = %d\n", zahl1, zahl2, zahl3, ergeb); + + return 0; +} diff --git a/c/c-tutorial/pair.c b/c/c-tutorial/pair.c new file mode 100644 index 0000000..1e94c3c --- /dev/null +++ b/c/c-tutorial/pair.c @@ -0,0 +1,15 @@ +#include <stdio.h> + +int main() { + int x; + printf("Bitte geben Sie eine Zahl ein: "); + scanf("%d", &x); + + if (x & 1) { + printf("Eine ungerade Zahl\n"); + } else { + printf("Eine gerade Zahl\n"); + } + + return 0; +} diff --git a/c/c-tutorial/pseudozugruffsrechte/Makefile b/c/c-tutorial/pseudozugruffsrechte/Makefile new file mode 100644 index 0000000..c6f34e9 --- /dev/null +++ b/c/c-tutorial/pseudozugruffsrechte/Makefile @@ -0,0 +1,9 @@ + +testprogramm : main.o pseudo.o + gcc -o testprogramm main.o pseudo.o + +main.o : main.c + gcc -c main.c + +pseudo.o : pseudo.c + gcc -c pseudo.c diff --git a/c/c-tutorial/pseudozugruffsrechte/datei.c b/c/c-tutorial/pseudozugruffsrechte/datei.c new file mode 100644 index 0000000..aa55ca0 --- /dev/null +++ b/c/c-tutorial/pseudozugruffsrechte/datei.c @@ -0,0 +1 @@ +extern int global_int; diff --git a/c/c-tutorial/pseudozugruffsrechte/externedatei.c b/c/c-tutorial/pseudozugruffsrechte/externedatei.c new file mode 100644 index 0000000..56241eb --- /dev/null +++ b/c/c-tutorial/pseudozugruffsrechte/externedatei.c @@ -0,0 +1 @@ +int global_int = 5; diff --git a/c/c-tutorial/pseudozugruffsrechte/main.c b/c/c-tutorial/pseudozugruffsrechte/main.c new file mode 100644 index 0000000..a7c9fdb --- /dev/null +++ b/c/c-tutorial/pseudozugruffsrechte/main.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include "pseudo.h" + +extern int publicValue; + +int main ( ) +{ + printf("Public = %d\n", publicValue); + + publicValue = 500; + + printf("Public = %d\n", publicValue); + + printf("Private = %d\n", getPrivate()); +} diff --git a/c/c-tutorial/pseudozugruffsrechte/pseudo.c b/c/c-tutorial/pseudozugruffsrechte/pseudo.c new file mode 100644 index 0000000..6bebd06 --- /dev/null +++ b/c/c-tutorial/pseudozugruffsrechte/pseudo.c @@ -0,0 +1,9 @@ +#include "pseudo.h" + +int publicValue = 10; +static int privateValue = 20; + +int getPrivate ( ) +{ + return privateValue; +} diff --git a/c/c-tutorial/pseudozugruffsrechte/pseudo.h b/c/c-tutorial/pseudozugruffsrechte/pseudo.h new file mode 100644 index 0000000..b21c5ec --- /dev/null +++ b/c/c-tutorial/pseudozugruffsrechte/pseudo.h @@ -0,0 +1 @@ +int getPrivate(void); diff --git a/c/c-tutorial/rectangle.c b/c/c-tutorial/rectangle.c new file mode 100644 index 0000000..afa81f2 --- /dev/null +++ b/c/c-tutorial/rectangle.c @@ -0,0 +1,16 @@ +#include <stdio.h> + +int main() { + float flaeche, l, b; + + printf("Berechnung der Flaeche eines Rechtecks\n"); + printf("Laenge des Rechtecks: "); + scanf("%f", &l); + + printf("Breite des Rechtecks: "); + scanf("%f", &b); + + flaeche = l * b; + printf("Flaeche des Rechtecks betraegt: %f\n", flaeche); + return 0; +} diff --git a/c/c-tutorial/referenz.c b/c/c-tutorial/referenz.c new file mode 100644 index 0000000..311e775 --- /dev/null +++ b/c/c-tutorial/referenz.c @@ -0,0 +1,9 @@ +#include <stdio.h> + +int main () { + int i; + printf("Bitte geben Sie eine Zahl ein : "); + scanf("%d", &i); + printf("Die Zahl die Sie eingegeben haben war %d\n", i); + return 0; +} diff --git a/c/c-tutorial/scan.c b/c/c-tutorial/scan.c new file mode 100644 index 0000000..a8bd8a5 --- /dev/null +++ b/c/c-tutorial/scan.c @@ -0,0 +1,24 @@ +#include <stdio.h> + +int main() { + char a,b,c; + + printf("1. Buchstabe : "); + do { + scanf("%c", &a); + } while ( getchar() != '\n' ); + + printf("2. Buchstabe : "); + do { + scanf("%c", &b); + } while ( getchar() != '\n' ); + + printf("3. Buchstabe : "); + do { + scanf("%c", &c); + } while ( getchar() != '\n' ); + + printf("Sie gaben ein : %c %c %c ",a,b,c); + + return 0; +} diff --git a/c/c-tutorial/scanf2.c b/c/c-tutorial/scanf2.c new file mode 100644 index 0000000..2a36301 --- /dev/null +++ b/c/c-tutorial/scanf2.c @@ -0,0 +1,29 @@ +#include <stdio.h> + +int main() { + int a,b,check; + + printf("Bitte zwei Zahlen eingeben: "); + check = scanf("%d %d", &a, &b); + getchar(); + + if ( check == 2) { + printf("Beide Zahlen richtig %d und %d\n",a,b); + } else { + if ( check == 1 ) { + printf("Die 2. Zahl hat das falsche Format!!\n"); + printf("Bitte Eingabe wiederholen: "); + check = scanf("%d", &b); + fflush( stdin ); + if ( check ) { + printf("Eingabe Ok. Ihre Zahlen sind %d %d\n", a,b); + } else { + printf("Leider nochmals falsch\n"); + } + } else { + printf("Die Erste oder beide Eingaben waren falsch!\n"); + } + } + + return 0; +} diff --git a/c/c-tutorial/shiftleft.c b/c/c-tutorial/shiftleft.c new file mode 100644 index 0000000..c3f7ccc --- /dev/null +++ b/c/c-tutorial/shiftleft.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +int main() { + char x = 8; + printf("x = %d\n", x); + + x <<=1; /* Alle Bits um 1 Stelle nach links */ + printf("x = %d\n", x); + + return 0; +} diff --git a/c/c-tutorial/sizeof.c b/c/c-tutorial/sizeof.c new file mode 100644 index 0000000..950adf6 --- /dev/null +++ b/c/c-tutorial/sizeof.c @@ -0,0 +1,15 @@ +#include <stdio.h> + +int main() { + printf("char = %d Byte\n", sizeof(char)); + printf("int = %d Byte\n", sizeof(int)); + printf("long = %d Byte\n", sizeof(long int)); + printf("float = %d Byte\n", sizeof(float)); + printf("double = %d Byte\n", sizeof(double)); + printf("66 = %d Byte\n", sizeof(66)); + printf("Hallo = %d Byte\n", sizeof("Hallo")); + printf("A = %d Byte\n", sizeof((char)'A')); + printf("34343434 = %d Byte\n", sizeof(34343434)); + + return 0; +} diff --git a/c/c-tutorial/steuerzeichen.c b/c/c-tutorial/steuerzeichen.c new file mode 100644 index 0000000..b4b35d4 --- /dev/null +++ b/c/c-tutorial/steuerzeichen.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +int main() { + printf("Ein akkustisches Signal mit : (\a)\a"); + printf("\nEin Backspace mit : (\b) | \bx\n"); + printf("Ein Zeilenvorschub mti : (\t) |\tx"); + printf("\n\tC\n\ti\n\ts\n\tt\n\ttoll\n"); + printf("\t u\n\t n\n\t d\n"); + printf("\t macht Spass\n"); + return 0; +} diff --git a/c/c-tutorial/suchmengen.c b/c/c-tutorial/suchmengen.c new file mode 100644 index 0000000..c08b957 --- /dev/null +++ b/c/c-tutorial/suchmengen.c @@ -0,0 +1,10 @@ +#include <stdio.h> + +int main() { + char str[20]; + printf("Bitte geben etwas ein: "); + scanf("%19[^xyz]", str); + + printf("%s\n", str); + return 0; +} diff --git a/c/c-tutorial/thread1.c b/c/c-tutorial/thread1.c new file mode 100644 index 0000000..71e40e7 --- /dev/null +++ b/c/c-tutorial/thread1.c @@ -0,0 +1,30 @@ +#include <pthread.h> +#include <stdlib.h> +#include <unistd.h> + +void *thread_function ( void *arg ) { + int i; + for ( i = 0; i < 20; i++ ) { + printf("Thread says hi!\n"); + sleep(1); + } + + return NULL; +} + +int main ( void ) { + + pthread_t mythread; + + if ( pthread_create(&mythread, NULL, thread_function, NULL) ) { + printf("error creating thread.\n"); + abort(); + } + + if ( pthread_join(mythread, NULL) ) { + printf("error joining thread.\n"); + abort(); + } + + exit(0); +} diff --git a/c/c-tutorial/thread2.c b/c/c-tutorial/thread2.c new file mode 100644 index 0000000..0cf582d --- /dev/null +++ b/c/c-tutorial/thread2.c @@ -0,0 +1,49 @@ +#include <pthread.h> +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> + + +int myglobal; + +void *thread_function ( void *arg ) { + int i,j; + + for ( i = 0; i < 20; i++ ) { + j = myglobal; + j = j + 1; + printf("."); + fflush(stdout); + sleep(2); + myglobal = j; + } + + return NULL; +} + +int main ( void ) { + + pthread_t mythread; + int i; + + if ( pthread_create(&mythread, NULL, thread_function, NULL) ) { + printf("error creating thread.\n"); + abort(); + } + + for ( i = 0; i < 20; i++) { + myglobal = myglobal + 1; + printf("o"); + fflush(stdout); + sleep(1); + } + + if ( pthread_join(mythread, NULL) ) { + printf("error joining thread"); + abort(); + } + + printf("\nmyglobal equals %d", myglobal); + + exit(0); +} diff --git a/c/c-tutorial/tiefstand.c b/c/c-tutorial/tiefstand.c new file mode 100644 index 0000000..a4ea1cd --- /dev/null +++ b/c/c-tutorial/tiefstand.c @@ -0,0 +1,15 @@ +#include <stdio.h> + +int main () { + char text[] = "Tiefstand"; + + printf("|01234567890123456789|\n"); + printf("|%s|\n",text); + printf("|%20s|\n",text); + printf("|%-20s|\n",text); + printf("|%20s|\n",text+4); + printf("|%20.4s|\n",text); + printf("|%-20.4s|\n",text); + printf("|%-20s|\n",text+4); + return 0; +} diff --git a/c/c-tutorial/ungenau.c b/c/c-tutorial/ungenau.c new file mode 100644 index 0000000..f361ad6 --- /dev/null +++ b/c/c-tutorial/ungenau.c @@ -0,0 +1,15 @@ +#include <stdio.h> + +int main() { + float x = 1.1234; + float dollar = 100000.12; + float end_float; + + double y = 1.1234; + double DOLLAR = 100000.12; + double end_double; + + printf("%f Euro mit float\n", end_float = dollar*x); + printf("%f Euro mit double\n", end_double = DOLLAR * y); + return 0; +} diff --git a/c/c-tutorial/vars.c b/c/c-tutorial/vars.c new file mode 100644 index 0000000..2602271 --- /dev/null +++ b/c/c-tutorial/vars.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +int main () { + int a = 5; + int b = 100, c = 12345; + printf("Wert von int a=%d, b=%d, c=%d\n",a,b,c); + return 0; +} diff --git a/c/c-tutorial/zeit.c b/c/c-tutorial/zeit.c new file mode 100644 index 0000000..a8fc5f4 --- /dev/null +++ b/c/c-tutorial/zeit.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +int main() { + int sekunden, minuten; + + printf("Bitte geben Sie die Zeit in Sekunden ein :"); + scanf("%d", &sekunden); + minuten = sekunden / 60; + sekunden = sekunden % 60; + printf("genauer = %d min. %d sek. \n", minuten, sekunden); + return 0; +} diff --git a/c/c-tutorial/zuweisung.c b/c/c-tutorial/zuweisung.c new file mode 100644 index 0000000..82463bc --- /dev/null +++ b/c/c-tutorial/zuweisung.c @@ -0,0 +1,19 @@ +#include <stdio.h> + +int main() { + int x = 2, y = 4, z = 6; + + printf("x = %d\n", x); + printf("y = %d\n", y); + printf("z = %d\n", z); + + printf("%d\n", x += y); + printf("%d\n", z += y); + printf("%d\n", z += x); + + printf("x = %d\n", x); /* x wurde ver�ndert */ + printf("y = %d\n", y); /* y bleibt gleich */ + printf("z = %d\n", z); /* z wurde ver�ndert */ + + return 0; +}