Re: Aufgaben und Übungen,

Also, mir fällt auf, das ist der Programmquelltext, dass ich die Adjezenzmmatrix quasi schon habe. Ich habe nicht mehr dran gedacht

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define EMPTY_Z -1
#define UNINIT_Z -2

int main (void) {
    time_t t;
    int i, j;
    int z [4][2];
    int flag;

    srand ((unsigned)time (\&amp;t));


    for (i = 0;  i < 4;  i++) {
        z [i][0] = i;
        z [i][1] = i;
    }
    flag = 0;
    while (!flag) {
        for (i = 0;  i < 4;  i++) {
            for (j = i + 1;  j < 4;  j++) {
                if ((rand () % 32) > 16) {
                    t = z [j][0];
                    z [j][0] = z[i][0];
                    z [i][0] = t;
                }
            }
        }
        for (i = 0;  i < 4;  i++) {
            for (j = i + 1;  j < 4;  j++) {
                if ((rand () % 16) < 8) {
                    t = z [j][1];
                    z [j][1] = z[i][1];
                    z [i][1] = t;
                }
            }
        }
        flag = 1;
        for (i = 0;  i < 4;  i++)
            if ((z[i][0] == z[i][1]) \&amp;\&amp; (z[i][1] == i)) {
                flag = 0;
            }

    }

printf("\documentclass{article}n");
printf("\usepackage[utf8]{inputenc}n");
printf("\usepackage{pgf, tikz}n");
printf("\usetikzlibrary{arrows , automata , positioning}n");
printf("\begin{document}nn");


printf("\begin{center}n");
printf("\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm]n");
printf("%Knotenn");
printf("\node (0) [state, thick] {0};n");
printf("\node (1) [state, thick, right of= 0] {1};n");
printf("\node (2) [state, thick, above of= 1, right of= 1] {2};n");
printf("\node (3) [state, thick, above of= 2, right of= 0] {3};nn");

printf("%Verbindungenn");
printf("\path[thick,->]n");


char *leftright [] = {"left", "right"};
char *abovebelow [] = {"above", "below"};

for (i = 0;  i < 4;  i++) {
        j = 0;
        fprintf(stderr, "%in", z [i][0]);
        if (z [i][j] == i)
            printf ("(%i) edge [loop] node {%i/%i} (%i)n", i, j, rand () % 4, z[i][j]);
        else
            printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i, (i+1)*10+z[j][j]*5, leftright [(i>z[i][j])\&amp;\&amp;(z[i][j] != 3)], abovebelow [(i<=z[i][j])\&amp;\&amp;(z[i][j] != 3)], j, rand () % 4, z[i][j]);
        j = 1;
        if (z [i][j] == i)
            printf ("(%i) edge [loop] node {%i/%i} (%i)n", i, j, rand () % 4, z[i][j]);
        else
            printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i, (i+1)*25+z[j][j]*8, leftright [(i<=z[i][j]) \&amp;\&amp;(z[i][j] != 3)], abovebelow [(i>z[i][j])\&amp;\&amp;(z[i][j] != 3)], j, rand () % 4, z[i][j]);
}
printf(";n");
printf("\end{tikzpicture}n");
printf("\end{center}n");
printf("\end{document}n");


return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>



#define MAX_SPECIAL_STATES      3
#define MAX_STATES              4
#define MIN_STATE               1
#define SPECIAL_STATE_1         1
#define SPECIAL_STATE_2         2
#define SPECIAL_STATE_3         3
#define MAX_INPUTS              2
#define MAX_OUTPUTS             2
#define TRUE                    1
#define FALSE                   0



void createnew (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
#define RAND_1      32
#define RAND_2      16
#define RAND_3      16
#define RAND_4      8

#define Z_A         0
#define Z_B         1

    time_t t;
    int i, j;
    int z [4][2];
    int flag;

    srand ((unsigned)time (\&amp;t));


    for (i = 0;  i < MAX_STATES;  i++) {
        z [i][Z_A] = i + MIN_STATE;
        z [i][Z_B] = i + MIN_STATE;
    }
    flag = 0;
    while (!flag) {
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_1) > RAND_2) {
                    t = z [j][Z_A];
                    z [j][Z_A] = z[i][Z_A];
                    z [i][Z_A] = t;
                }
            }
        }
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_3) < RAND_4) {
                    t = z [j][Z_B];
                    z [j][Z_B] = z[i][Z_B];
                    z [i][Z_B] = t;
                }
            }
        }
        flag = TRUE;
        for (i = 0;  i < MAX_STATES;  i++)
            if ((z[i][Z_A] == z[i][Z_B]) \&amp;\&amp; (z[i][Z_B] == i)) {
                flag = FALSE;
            }

    }
    for (i = 0;  i < MAX_STATES;  i++) {
        a [i] = z [Z_A][i];
        b [i] = z [Z_B][i];
        y [Z_A][i] = rand () % MAX_OUTPUTS;
        y [Z_B][i] = rand () % MAX_OUTPUTS;
    }

return;
}

int main (void) {
    time_t t;
    int i, j;
    int b [MAX_STATES];
    int a [MAX_STATES];
    int y [MAX_OUTPUTS][MAX_STATES];
    int flag;

    srand ((unsigned)time (\&amp;t));

    createnew (a, b, y);

printf("\documentclass{article}n");
printf("\usepackage[utf8]{inputenc}n");
printf("\usepackage{pgf, tikz}n");
printf("\usetikzlibrary{arrows , automata , positioning}n");
printf("\begin{document}nn");


printf("\begin{center}n");
printf("\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm]n");
printf("%Knotenn");

printf("\node (1) [state, thick] {1};n");
printf("\node (2) [state, thick, right of= 1] {2};n");
printf("\node (3) [state, thick, above of= 2, right of= 2] {3};n");
printf("\node (4) [state, thick, above of= 3, right of= 1] {4};nn");

printf("%Verbindungenn");
printf("\path[thick,->]n");


char *leftright [] = {"left", "right"};
char *abovebelow [] = {"above", "below"};

for (i = 0;  i < MAX_STATES;  i++) {
        if ((a [i] - MIN_STATE) == i)
            printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_A, y [Z_A][i], a [i]);
        else
            printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*10+(a[i]-MIN_STATE)*5, leftright [(i>(a [i]-MIN_STATE))\&amp;\&amp;((a [i]-MIN_STATE) != 3)], abovebelow [((i+1)<=a[i])\&amp;\&amp;(a[i] != 4)], Z_A, y [Z_A][i], a [i]);
        if ((b [i] - MIN_STATE) == i)
            printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_B, y [Z_B][i], b [i]);
        else
            printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*25+(b[i]-MIN_STATE)*8, leftright [(i<=(b [i]-MIN_STATE)) \&amp;\&amp;((b [i]-MIN_STATE) != 3)], abovebelow [((i+MIN_STATE)>b [i])\&amp;\&amp;(b [i] != 4)], Z_B, y [Z_B][i], b [i]);
}
printf(";n");
printf("\end{tikzpicture}n");
printf("\end{center}n");
printf("\end{document}n");


return 0;
}

Image automat20240207c-1

Image automat20240207d-1

Image automat20240207e-1

Image automat20240207f-1

Image automat20240207g-1

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>



#define MAX_SPECIAL_STATES      3
#define MAX_STATES              4
#define MIN_STATE               1
#define SPECIAL_STATE_1         1
#define SPECIAL_STATE_2         2
#define SPECIAL_STATE_3         3
#define MAX_INPUTS              2
#define MAX_OUTPUTS             2
#define TRUE                    1
#define FALSE                   0
#define Z_A                     0
#define Z_B                     1


void readcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    int j;
    int i1, i2;
    int x1, x2;
    scanf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < MAX_STATES;  i += 2) {
        printf ("%i,%i,%i,%in", i1, x1, y [Z_A][i], a [i]);
        printf ("%i,%i,%i,%in", i2, x2, y [Z_B][i+1], b [i+1]);
        if (x1 != Z_A) {
            printf ("Error - I/On");
            exit (1);
        }
        if (x2 != Z_B) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i1 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i2 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }
    }

return;
}


void printcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    printf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < (MAX_STATES);  i++) {
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_A, y [Z_A][i], a [i]);
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_B, y [Z_B][i], b [i]);
    }

return;
}



void createnew (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
#define RAND_1      32
#define RAND_2      16
#define RAND_3      16
#define RAND_4      8


    time_t t;
    int i, j;
    int z [4][2];
    int flag;

    srand ((unsigned)time (\&amp;t));


    for (i = 0;  i < MAX_STATES;  i++) {
        z [i][Z_A] = i + MIN_STATE;
        z [i][Z_B] = i + MIN_STATE;
    }
    flag = 0;
    while (!flag) {
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_1) > RAND_2) {
                    t = z [j][Z_A];
                    z [j][Z_A] = z[i][Z_A];
                    z [i][Z_A] = t;
                }
            }
        }
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_3) < RAND_4) {
                    t = z [j][Z_B];
                    z [j][Z_B] = z[i][Z_B];
                    z [i][Z_B] = t;
                }
            }
        }
        flag = TRUE;
        for (i = 0;  i < MAX_STATES;  i++)
            if ((z[i][Z_A] == z[i][Z_B]) \&amp;\&amp; (z[i][Z_B] == i)) {
                flag = FALSE;
            }

    }
    for (i = 0;  i < MAX_STATES;  i++) {
        a [i] = z [Z_A][i];
        b [i] = z [Z_B][i];
        y [Z_A][i] = rand () % MAX_OUTPUTS;
        y [Z_B][i] = rand () % MAX_OUTPUTS;
    }

return;
}

void createpdf (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i, j;
    printf("\documentclass{article}n");
    printf("\usepackage[utf8]{inputenc}n");
    printf("\usepackage{pgf, tikz}n");
    printf("\usetikzlibrary{arrows , automata , positioning}n");
    printf("\begin{document}nn");


    printf("\begin{center}n");
    printf("\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm]n");
    printf("%Knotenn");

    printf("\node (1) [state, thick] {1};n");
    printf("\node (2) [state, thick, right of= 1] {2};n");
    printf("\node (3) [state, thick, above of= 2, right of= 2] {3};n");
    printf("\node (4) [state, thick, above of= 3, right of= 1] {4};nn");

    printf("%Verbindungenn");
    printf("\path[thick,->]n");


    char *leftright [] = {"left", "right"};
    char *abovebelow [] = {"above", "below"};

    for (i = 0;  i < MAX_STATES;  i++) {
            if ((a [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_A, y [Z_A][i], a [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*10+(a[i]-MIN_STATE)*5, leftright [(i>(a [i]-MIN_STATE))\&amp;\&amp;((a [i]-MIN_STATE) != 3)], abovebelow    [((i+1)<=a[i])\&amp;\&amp;(a[i] != 4)], Z_A, y [Z_A][i], a [i]);
            if ((b [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_B, y [Z_B][i], b [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*25+(b[i]-MIN_STATE)*8, leftright [(i<=(b [i]-MIN_STATE)) \&amp;\&amp;((b [i]-MIN_STATE) != 3)], abovebelow [((i+MIN_STATE)>b [i])\&amp;\&amp;(b [i] != 4)], Z_B, y [Z_B][i], b [i]);
    }
    printf(";n");
    printf("\end{tikzpicture}n");
    printf("\end{center}n");
    printf("\end{document}n");

}

int main (void) {
    int b [MAX_STATES];
    int a [MAX_STATES];
    int y [MAX_OUTPUTS][MAX_STATES];



    createnew (a, b, y);
    printcsv (a, b, y);



return 0;
}

Zustand,Eingabe,Ausgabe,Folgezustand
1,0,0,4
1,1,0,3
2,0,0,4
2,1,1,2
3,0,0,3
3,1,1,1
4,0,0,2
4,1,0,3

Zustand,Eingabe,Ausgabe,Folgezustand
1,0,0,2
1,1,1,4
2,0,1,3
2,1,1,2
3,0,0,4
3,1,1,3
4,0,0,2
4,1,0,4
[/code}

[code]
Zustand,Eingabe,Ausgabe,Folgezustand
1,0,1,1
1,1,1,2
2,0,0,2
2,1,0,3
3,0,0,2
3,1,1,3
4,0,0,3
4,1,0,1

Zustand,Eingabe,Ausgabe,Folgezustand
1,0,0,4
1,1,0,1
2,0,1,4
2,1,0,3
3,0,1,1
3,1,0,3
4,0,0,3
4,1,0,2

Zustand,Eingabe,Ausgabe,Folgezustand
1,0,1,4
1,1,0,3
2,0,0,4
2,1,0,1
3,0,1,3
3,1,1,1
4,0,0,1
4,1,0,2

Zustand,Eingabe,Ausgabe,Folgezustand
1,0,1,4
1,1,1,1
2,0,0,3
2,1,0,4
3,0,0,1
3,1,1,3
4,0,0,4
4,1,0,2

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>



#define MAX_SPECIAL_STATES      3
#define MAX_STATES              4
#define MIN_STATE               1
#define SPECIAL_STATE_1         1
#define SPECIAL_STATE_2         2
#define SPECIAL_STATE_3         3
#define MAX_INPUTS              2
#define MAX_OUTPUTS             2
#define TRUE                    1
#define FALSE                   0
#define Z_A                     0
#define Z_B                     1


void readcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    int j;
    int i1, i2;
    int x1, x2;
    scanf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < MAX_STATES;  i += 2) {
        printf ("%i,%i,%i,%in", i1, x1, y [Z_A][i], a [i]);
        printf ("%i,%i,%i,%in", i2, x2, y [Z_B][i+1], b [i+1]);
        if (x1 != Z_A) {
            printf ("Error - I/On");
            exit (1);
        }
        if (x2 != Z_B) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i1 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i2 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }
    }

return;
}


void printcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    printf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < (MAX_STATES);  i++) {
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_A, y [Z_A][i], a [i]);
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_B, y [Z_B][i], b [i]);
    }

return;
}



void createnew (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
#define RAND_1      32
#define RAND_2      16
#define RAND_3      16
#define RAND_4      8


    time_t t;
    int i, j;
    int z [4][2];
    int flag;

    srand ((unsigned)time (\&amp;t));


    for (i = 0;  i < MAX_STATES;  i++) {
        z [i][Z_A] = i + MIN_STATE;
        z [i][Z_B] = i + MIN_STATE;
    }
    flag = 0;
    while (!flag) {
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_1) > RAND_2) {
                    t = z [j][Z_A];
                    z [j][Z_A] = z[i][Z_A];
                    z [i][Z_A] = t;
                }
            }
        }
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_3) < RAND_4) {
                    t = z [j][Z_B];
                    z [j][Z_B] = z[i][Z_B];
                    z [i][Z_B] = t;
                }
            }
        }
        flag = TRUE;
        for (i = 0;  i < MAX_STATES;  i++)
            if ((z[i][Z_A] == z[i][Z_B]) \&amp;\&amp; (z[i][Z_B] == i)) {
                flag = FALSE;
            }

    }
    for (i = 0;  i < MAX_STATES;  i++) {
        a [i] = z [Z_A][i];
        b [i] = z [Z_B][i];
        y [Z_A][i] = rand () % MAX_OUTPUTS;
        y [Z_B][i] = rand () % MAX_OUTPUTS;
    }

return;
}

void printtex (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i, j;
    printf("\documentclass{article}n");
    printf("\usepackage[utf8]{inputenc}n");
    printf("\usepackage{pgf, tikz}n");
    printf("\usetikzlibrary{arrows , automata , positioning}n");
    printf("\begin{document}nn");


    printf("\begin{center}n");
    printf("\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm]n");
    printf("%Knotenn");

    printf("\node (1) [state, thick] {1};n");
    printf("\node (2) [state, thick, right of= 1] {2};n");
    printf("\node (3) [state, thick, above of= 2, right of= 2] {3};n");
    printf("\node (4) [state, thick, above of= 3, right of= 1] {4};nn");

    printf("%Verbindungenn");
    printf("\path[thick,->]n");


    char *leftright [] = {"left", "right"};
    char *abovebelow [] = {"above", "below"};

    for (i = 0;  i < MAX_STATES;  i++) {
            if ((a [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_A, y [Z_A][i], a [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*10+(a[i]-MIN_STATE)*5, leftright [(i>(a [i]-MIN_STATE))\&amp;\&amp;((a [i]-MIN_STATE) != 3)], abovebelow    [((i+1)<=a[i])\&amp;\&amp;(a[i] != 4)], Z_A, y [Z_A][i], a [i]);
            if ((b [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_B, y [Z_B][i], b [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*25+(b[i]-MIN_STATE)*8, leftright [(i<=(b [i]-MIN_STATE)) \&amp;\&amp;((b [i]-MIN_STATE) != 3)], abovebelow [((i+MIN_STATE)>b [i])\&amp;\&amp;(b [i] != 4)], Z_B, y [Z_B][i], b [i]);
    }
    printf(";n");
    printf("\end{tikzpicture}n");
    printf("\end{center}n");
    printf("\end{document}n");

}

int main (int argc, char *argv []) {
    #define CREATE_NEW      0
    #define READ_CSV        1
    #define PRINT_TEX       0
    #define PRINT_CSV       1
    #define PRINT_NO_HELP   0
    #define PRINT_HELP      1

    int b [MAX_STATES];
    int a [MAX_STATES];
    int y [MAX_OUTPUTS][MAX_STATES];
    int argi;
    int createnew_readcsv = CREATE_NEW;
    int printraw_printtex_print_csv = PRINT_CSV;
    int printhelp = PRINT_NO_HELP;

    for (argi = 1;  argi < argc;  argi++) {
        if ((strcmp ("--create-new", argv [argi]) == 0) || (strcmp ("-n", argv [argi]) == 0))
            createnew_readcsv = CREATE_NEW;
        if ((strcmp ("--read-csv", argv [argi]) == 0) || (strcmp ("-s", argv [argi]) == 0))
            createnew_readcsv = READ_CSV;
        if ((strcmp ("--print-csv", argv [argi]) == 0) || (strcmp ("-c", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_CSV;
        if ((strcmp ("--print-tex", argv [argi]) == 0) || (strcmp ("-t", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_TEX;
        if ((strcmp ("--help", argv [argi]) == 0) || (strcmp ("-h", argv [argi]) == 0))
            printhelp = PRINT_HELP;
    }
    if (printhelp == PRINT_HELP) {
        printf ("--create-newn-nnn");
        printf ("--read-csvn-rnn");
        printf ("--print-csvn-cnn");
        printf ("--print-texn-tnn");
        printf ("--helpn-hnn");
        return 2;
    }
    if (createnew_readcsv == CREATE_NEW)
        createnew (a, b, y);
    else if (createnew_readcsv == READ_CSV)
        readcsv (a, b, y);
    if (printraw_printtex_print_csv == PRINT_TEX)
        printtex (a, b, y);
    else if (printraw_printtex_print_csv == PRINT_CSV)
        printcsv (a, b, y);
return 0;
}

// Jetzt habe ich das schon besser hingekriegt

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define MAX_SPECIAL_STATES      3
#define MAX_STATES              4
#define MIN_STATE               1
#define SPECIAL_STATE_1         1
#define SPECIAL_STATE_2         2
#define SPECIAL_STATE_3         3
#define MAX_INPUTS              2
#define MAX_OUTPUTS             2
#define TRUE                    1
#define FALSE                   0
#define Z_A                     0
#define Z_B                     1

void readcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    int j;
    int i1, i2;
    int x1, x2;
    scanf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < MAX_STATES;  i += 2) {
        printf ("%i,%i,%i,%in", i1, x1, y [Z_A][i], a [i]);
        printf ("%i,%i,%i,%in", i2, x2, y [Z_B][i+1], b [i+1]);
        if (x1 != Z_A) {
            printf ("Error - I/On");
            exit (1);
        }
        if (x2 != Z_B) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i1 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i2 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }
    }

return;
}

void printcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    printf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < (MAX_STATES);  i++) {
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_A, y [Z_A][i], a [i]);
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_B, y [Z_B][i], b [i]);
    }

return;
}

void createnew (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
#define RAND_1      32
#define RAND_2      16
#define RAND_3      16
#define RAND_4      8

    time_t t;
    int i, j;
    int z [4][2];
    int flag;

    srand ((unsigned)time (\&amp;t));

    for (i = 0;  i < MAX_STATES;  i++) {
        z [i][Z_A] = i + MIN_STATE;
        z [i][Z_B] = i + MIN_STATE;
    }
    flag = 0;
    while (!flag) {
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_1) > RAND_2) {
                    t = z [j][Z_A];
                    z [j][Z_A] = z[i][Z_A];
                    z [i][Z_A] = t;
                }
            }
        }
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_3) < RAND_4) {
                    t = z [j][Z_B];
                    z [j][Z_B] = z[i][Z_B];
                    z [i][Z_B] = t;
                }
            }
        }
        flag = TRUE;
        for (i = 0;  i < MAX_STATES;  i++)
            if ((z[i][Z_A] == z[i][Z_B]) \&amp;\&amp; (z[i][Z_B] == i)) {
                flag = FALSE;
            }

    }
    for (i = 0;  i < MAX_STATES;  i++) {
        a [i] = z [Z_A][i];
        b [i] = z [Z_B][i];
        y [Z_A][i] = rand () % MAX_OUTPUTS;
        y [Z_B][i] = rand () % MAX_OUTPUTS;
    }

return;
}

void printtex (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i, j;
    printf("\documentclass{article}n");
    printf("\usepackage[utf8]{inputenc}n");
    printf("\usepackage{pgf, tikz}n");
    printf("\usetikzlibrary{arrows , automata , positioning}n");
    printf("\begin{document}nn");

    printf("\begin{center}n");
    printf("\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm]n");
    printf("%Knotenn");

    printf("\node (1) [state, thick] {1};n");
    printf("\node (2) [state, thick, right of= 1] {2};n");
    printf("\node (3) [state, thick, above of= 2, right of= 2] {3};n");
    printf("\node (4) [state, thick, above of= 3, right of= 1] {4};nn");

    printf("%Verbindungenn");
    printf("\path[thick,->]n");

    char *leftright [] = {"left", "right"};
    char *abovebelow [] = {"above", "below"};

    for (i = 0;  i < MAX_STATES;  i++) {
            if ((a [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_A, y [Z_A][i], a [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*10+(a[i]-MIN_STATE)*5, leftright [(i>(a [i]-MIN_STATE))\&amp;\&amp;((a [i]-MIN_STATE) != 3)], abovebelow    [((i+1)<=a[i])\&amp;\&amp;(a[i] != 4)], Z_A, y [Z_A][i], a [i]);
            if ((b [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_B, y [Z_B][i], b [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*25+(b[i]-MIN_STATE)*8, leftright [(i<=(b [i]-MIN_STATE)) \&amp;\&amp;((b [i]-MIN_STATE) != 3)], abovebelow [((i+MIN_STATE)>b [i])\&amp;\&amp;(b [i] != 4)], Z_B, y [Z_B][i], b [i]);
    }
    printf(";n");
    printf("\end{tikzpicture}n");
    printf("\end{center}n");
    printf("\end{document}n");

}

int main (int argc, char *argv []) {
    #define CREATE_NEW      0
    #define READ_CSV        1
    #define PRINT_TEX       0
    #define PRINT_CSV       1
    #define PRINT_NO_HELP   0
    #define PRINT_HELP      1

    int b [MAX_STATES];
    int a [MAX_STATES];
    int y [MAX_OUTPUTS][MAX_STATES];
    int argi;
    int createnew_readcsv = CREATE_NEW;
    int printraw_printtex_print_csv = PRINT_CSV;
    int printhelp = PRINT_NO_HELP;

    for (argi = 1;  argi < argc;  argi++) {
        if ((strcmp ("--create-new", argv [argi]) == 0) || (strcmp ("-n", argv [argi]) == 0))
            createnew_readcsv = CREATE_NEW;
        if ((strcmp ("--read-csv", argv [argi]) == 0) || (strcmp ("-s", argv [argi]) == 0))
            createnew_readcsv = READ_CSV;
        if ((strcmp ("--print-csv", argv [argi]) == 0) || (strcmp ("-c", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_CSV;
        if ((strcmp ("--print-tex", argv [argi]) == 0) || (strcmp ("-t", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_TEX;
        if ((strcmp ("--help", argv [argi]) == 0) || (strcmp ("-h", argv [argi]) == 0))
            printhelp = PRINT_HELP;
    }
    if (printhelp == PRINT_HELP) {
        printf ("--create-newn-nnn");
        printf ("--read-csvn-rnn");
        printf ("--print-csvn-cnn");
        printf ("--print-texn-tnn");
        printf ("--helpn-hnn");
        return 2;
    }
    if (createnew_readcsv == CREATE_NEW)
        createnew (a, b, y);
    else if (createnew_readcsv == READ_CSV)
        readcsv (a, b, y);
    if (printraw_printtex_print_csv == PRINT_TEX)
        printtex (a, b, y);
    else if (printraw_printtex_print_csv == PRINT_CSV)
        printcsv (a, b, y);
return 0;
}

// so jetzt tut das Programm

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define MAX_SPECIAL_STATES      3
#define MAX_STATES              4
#define MIN_STATE               1
#define SPECIAL_STATE_1         1
#define SPECIAL_STATE_2         2
#define SPECIAL_STATE_3         3
#define MAX_INPUTS              2
#define MAX_OUTPUTS             2
#define TRUE                    1
#define FALSE                   0
#define Z_A                     0
#define Z_B                     1

void readcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    int j;
    int i1, i2;
    int x1, x2;
    scanf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < MAX_STATES * 2;  ) {
        scanf ("%i,%i,%i,%in", \&amp;i1, \&amp;x1, \&amp;y [Z_A][i], \&amp;a [i]);
        printf ("%i,%i,%i,%in", i1, x1, y [Z_A][i], a [i]);
        i++;
        scanf ("%i,%i,%i,%in", \&amp;i2, \&amp;x2, \&amp;y [Z_B][i], \&amp;b [i]);
        printf ("%i,%i,%i,%in", i2, x2, y [Z_B][i], b [i]);
        i++;

/*
        if (x1 != Z_A) {
            printf ("Error - I/On");
            exit (1);
        }
        if (x2 != Z_B) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i1 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i2 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }*/
    }

return;
}

void printcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    printf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < (MAX_STATES);  i++) {
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_A, y [Z_A][i], a [i]);
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_B, y [Z_B][i], b [i]);
    }

return;
}

void createnew (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
#define RAND_1      32
#define RAND_2      16
#define RAND_3      16
#define RAND_4      8

    time_t t;
    int i, j;
    int z [4][2];
    int flag;

    srand ((unsigned)time (\&amp;t));

    for (i = 0;  i < MAX_STATES;  i++) {
        z [i][Z_A] = i + MIN_STATE;
        z [i][Z_B] = i + MIN_STATE;
    }
    flag = 0;
    while (!flag) {
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_1) > RAND_2) {
                    t = z [j][Z_A];
                    z [j][Z_A] = z[i][Z_A];
                    z [i][Z_A] = t;
                }
            }
        }
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_3) < RAND_4) {
                    t = z [j][Z_B];
                    z [j][Z_B] = z[i][Z_B];
                    z [i][Z_B] = t;
                }
            }
        }
        flag = TRUE;
        for (i = 0;  i < MAX_STATES;  i++)
            if ((z[i][Z_A] == z[i][Z_B]) \&amp;\&amp; (z[i][Z_B] == i)) {
                flag = FALSE;
            }

    }
    for (i = 0;  i < MAX_STATES;  i++) {
        a [i] = z [Z_A][i];
        b [i] = z [Z_B][i];
        y [Z_A][i] = rand () % MAX_OUTPUTS;
        y [Z_B][i] = rand () % MAX_OUTPUTS;
    }

return;
}

void printtex (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i, j;
    printf("\documentclass{article}n");
    printf("\usepackage[utf8]{inputenc}n");
    printf("\usepackage{pgf, tikz}n");
    printf("\usetikzlibrary{arrows , automata , positioning}n");
    printf("\begin{document}nn");

    printf("\begin{center}n");
    printf("\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm]n");
    printf("%Knotenn");

    printf("\node (1) [state, thick] {1};n");
    printf("\node (2) [state, thick, right of= 1] {2};n");
    printf("\node (3) [state, thick, above of= 2, right of= 2] {3};n");
    printf("\node (4) [state, thick, above of= 3, right of= 1] {4};nn");

    printf("%Verbindungenn");
    printf("\path[thick,->]n");

    char *leftright [] = {"left", "right"};
    char *abovebelow [] = {"above", "below"};

    for (i = 0;  i < MAX_STATES;  i++) {
            if ((a [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_A, y [Z_A][i], a [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*10+(a[i]-MIN_STATE)*5, leftright [(i>(a [i]-MIN_STATE))\&amp;\&amp;((a [i]-MIN_STATE) != 3)], abovebelow    [((i+1)<=a[i])\&amp;\&amp;(a[i] != 4)], Z_A, y [Z_A][i], a [i]);
            if ((b [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_B, y [Z_B][i], b [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*25+(b[i]-MIN_STATE)*8, leftright [(i<=(b [i]-MIN_STATE)) \&amp;\&amp;((b [i]-MIN_STATE) != 3)], abovebelow [((i+MIN_STATE)>b [i])\&amp;\&amp;(b [i] != 4)], Z_B, y [Z_B][i], b [i]);
    }
    printf(";n");
    printf("\end{tikzpicture}n");
    printf("\end{center}n");
    printf("\end{document}n");

}

int main (int argc, char *argv []) {
    #define CREATE_NEW      0
    #define READ_CSV        1
    #define PRINT_TEX       0
    #define PRINT_CSV       1
    #define PRINT_NO_HELP   0
    #define PRINT_HELP      1

    int b [MAX_STATES];
    int a [MAX_STATES];
    int y [MAX_OUTPUTS][MAX_STATES];
    int argi;
    int createnew_readcsv = CREATE_NEW;
    int printraw_printtex_print_csv = PRINT_CSV;
    int printhelp = PRINT_NO_HELP;

    for (argi = 1;  argi < argc;  argi++) {
        if ((strcmp ("--create-new", argv [argi]) == 0) || (strcmp ("-n", argv [argi]) == 0))
            createnew_readcsv = CREATE_NEW;
        if ((strcmp ("--read-csv", argv [argi]) == 0) || (strcmp ("-s", argv [argi]) == 0))
            createnew_readcsv = READ_CSV;
        if ((strcmp ("--print-csv", argv [argi]) == 0) || (strcmp ("-c", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_CSV;
        if ((strcmp ("--print-tex", argv [argi]) == 0) || (strcmp ("-t", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_TEX;
        if ((strcmp ("--help", argv [argi]) == 0) || (strcmp ("-h", argv [argi]) == 0))
            printhelp = PRINT_HELP;
    }
    if (printhelp == PRINT_HELP) {
        printf ("--create-newn-nnn");
        printf ("--read-csvn-rnn");
        printf ("--print-csvn-cnn");
        printf ("--print-texn-tnn");
        printf ("--helpn-hnn");
        return 2;
    }
    if (createnew_readcsv == CREATE_NEW)
        createnew (a, b, y);
    else if (createnew_readcsv == READ_CSV)
        readcsv (a, b, y);
    if (printraw_printtex_print_csv == PRINT_TEX)
        printtex (a, b, y);
    else if (printraw_printtex_print_csv == PRINT_CSV)
        printcsv (a, b, y);
return 0;
}

// Also, es tut eigentlich, ich muss noch einen Brief einschmeissen, vorher poste ich das auf meiner Homepage

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define MAX_SPECIAL_STATES      3
#define MAX_STATES              4
#define MIN_STATE               1
#define SPECIAL_STATE_1         1
#define SPECIAL_STATE_2         2
#define SPECIAL_STATE_3         3
#define MAX_INPUTS              2
#define MAX_OUTPUTS             2
#define TRUE                    1
#define FALSE                   0
#define Z_A                     0
#define Z_B                     1

void readcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    int j;
    int i1, i2;
    int x1, x2;
    scanf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < MAX_STATES * 2;  ) {
        scanf ("%i,%i,%i,%in", \&amp;i1, \&amp;x1, \&amp;y [Z_A][i], \&amp;a [i]);
        i++;
        scanf ("%i,%i,%i,%in", \&amp;i2, \&amp;x2, \&amp;y [Z_B][i], \&amp;b [i]);
        i++;

/*
        if (x1 != Z_A) {
            printf ("Error - I/On");
            exit (1);
        }
        if (x2 != Z_B) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i1 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i2 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }*/
    }

return;
}

void printcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    printf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < (MAX_STATES);  i++) {
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_A, y [Z_A][i], a [i]);
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_B, y [Z_B][i], b [i]);
    }

return;
}

void createnew (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
#define RAND_1      32
#define RAND_2      16
#define RAND_3      16
#define RAND_4      8

    time_t t;
    int i, j;
    int z [4][2];
    int flag;

    srand ((unsigned)time (\&amp;t));

    for (i = 0;  i < MAX_STATES;  i++) {
        z [i][Z_A] = i + MIN_STATE;
        z [i][Z_B] = i + MIN_STATE;
    }
    flag = 0;
    while (!flag) {
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_1) > RAND_2) {
                    t = z [j][Z_A];
                    z [j][Z_A] = z[i][Z_A];
                    z [i][Z_A] = t;
                }
            }
        }
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_3) < RAND_4) {
                    t = z [j][Z_B];
                    z [j][Z_B] = z[i][Z_B];
                    z [i][Z_B] = t;
                }
            }
        }
        flag = TRUE;
        for (i = 0;  i < MAX_STATES;  i++)
            if ((z[i][Z_A] == z[i][Z_B]) \&amp;\&amp; (z[i][Z_B] == i)) {
                flag = FALSE;
            }

    }
    for (i = 0;  i < MAX_STATES;  i++) {
        a [i] = z [Z_A][i];
        b [i] = z [Z_B][i];
        y [Z_A][i] = rand () % MAX_OUTPUTS;
        y [Z_B][i] = rand () % MAX_OUTPUTS;
    }

return;
}

void printtex (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i, j;
    printf("\documentclass{article}n");
    printf("\usepackage[utf8]{inputenc}n");
    printf("\usepackage{pgf, tikz}n");
    printf("\usetikzlibrary{arrows , automata , positioning}n");
    printf("\begin{document}nn");

    printf("\begin{center}n");
    printf("\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm]n");
    printf("%Knotenn");

    printf("\node (1) [state, thick] {1};n");
    printf("\node (2) [state, thick, right of= 1] {2};n");
    printf("\node (3) [state, thick, above of= 2, right of= 2] {3};n");
    printf("\node (4) [state, thick, above of= 3, right of= 1] {4};nn");

    printf("%Verbindungenn");
    printf("\path[thick,->]n");

    char *leftright [] = {"left", "right"};
    char *abovebelow [] = {"above", "below"};

    for (i = 0;  i < MAX_STATES;  i++) {
            if ((a [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_A, y [Z_A][i], a [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*10+(a[i]-MIN_STATE)*5, leftright [(i>(a [i]-MIN_STATE))\&amp;\&amp;((a [i]-MIN_STATE) != 3)], abovebelow    [((i+1)<=a[i])\&amp;\&amp;(a[i] != 4)], Z_A, y [Z_A][i], a [i]);
            if ((b [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_B, y [Z_B][i], b [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*25+(b[i]-MIN_STATE)*8, leftright [(i<=(b [i]-MIN_STATE)) \&amp;\&amp;((b [i]-MIN_STATE) != 3)], abovebelow [((i+MIN_STATE)>b [i])\&amp;\&amp;(b [i] != 4)], Z_B, y [Z_B][i], b [i]);
    }
    printf(";n");
    printf("\end{tikzpicture}n");
    printf("\end{center}n");
    printf("\end{document}n");

}

int main (int argc, char *argv []) {
    #define CREATE_NEW      0
    #define READ_CSV        1
    #define PRINT_TEX       0
    #define PRINT_CSV       1
    #define PRINT_NO_HELP   0
    #define PRINT_HELP      1

    int b [MAX_STATES];
    int a [MAX_STATES];
    int y [MAX_OUTPUTS][MAX_STATES];
    int argi;
    int createnew_readcsv = CREATE_NEW;
    int printraw_printtex_print_csv = PRINT_CSV;
    int printhelp = PRINT_NO_HELP;

    for (argi = 1;  argi < argc;  argi++) {
        if ((strcmp ("--create-new", argv [argi]) == 0) || (strcmp ("-n", argv [argi]) == 0))
            createnew_readcsv = CREATE_NEW;
        if ((strcmp ("--read-csv", argv [argi]) == 0) || (strcmp ("-s", argv [argi]) == 0))
            createnew_readcsv = READ_CSV;
        if ((strcmp ("--print-csv", argv [argi]) == 0) || (strcmp ("-c", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_CSV;
        if ((strcmp ("--print-tex", argv [argi]) == 0) || (strcmp ("-t", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_TEX;
        if ((strcmp ("--help", argv [argi]) == 0) || (strcmp ("-h", argv [argi]) == 0))
            printhelp = PRINT_HELP;
    }
    if (printhelp == PRINT_HELP) {
        printf ("--create-newn-nnn");
        printf ("--read-csvn-rnn");
        printf ("--print-csvn-cnn");
        printf ("--print-texn-tnn");
        printf ("--helpn-hnn");
        return 2;
    }
    if (createnew_readcsv == CREATE_NEW)
        createnew (a, b, y);
    else if (createnew_readcsv == READ_CSV)
        readcsv (a, b, y);

    if (printraw_printtex_print_csv == PRINT_TEX)
        printtex (a, b, y);
    else if (printraw_printtex_print_csv == PRINT_CSV)
        printcsv (a, b, y);
return 0;
}

// Ja, ich habe hier einen klassischen Fall, von einer Bereichs"uberschreitung. Die Variable in der main Funktion hat ihren Wert ver"andert, weil ich in der Funktion, mit einem Array gearbeitet habe und Pointern - und - sobald ich den Wert der FOR-Schleife "andere - gr"osser mache, "andert sich der Wert der Variable, Option in der main funktion

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define MAX_SPECIAL_STATES      3
#define MAX_STATES              4
#define MIN_STATE               1
#define SPECIAL_STATE_1         1
#define SPECIAL_STATE_2         2
#define SPECIAL_STATE_3         3
#define MAX_INPUTS              2
#define MAX_OUTPUTS             2
#define TRUE                    1
#define FALSE                   0
#define Z_A                     0
#define Z_B                     1

void readcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    int j;
    int i1, i2;
    int x1, x2;
    scanf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < MAX_STATES ;  ) {
        scanf ("%i,%i,%i,%in", \&amp;i1, \&amp;x1, \&amp;y [Z_A][i], \&amp;a [i]);
        i++;
        scanf ("%i,%i,%i,%in", \&amp;i2, \&amp;x2, \&amp;y [Z_B][i], \&amp;b [i]);
        i++;

/*
        if (x1 != Z_A) {
            printf ("Error - I/On");
            exit (1);
        }
        if (x2 != Z_B) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i1 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i2 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }*/
    }

return;
}

void printcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    printf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < (MAX_STATES);  i++) {
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_A, y [Z_A][i], a [i]);
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_B, y [Z_B][i], b [i]);
    }

return;
}

void createnew (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
#define RAND_1      32
#define RAND_2      16
#define RAND_3      16
#define RAND_4      8

    time_t t;
    int i, j;
    int z [MAX_STATES][MAX_OUTPUTS];
    int flag;

    srand ((unsigned)time (\&amp;t));

    for (i = 0;  i < MAX_STATES;  i++) {
        z [i][Z_A] = i + MIN_STATE;
        z [i][Z_B] = i + MIN_STATE;
    }
    flag = 0;
    while (!flag) {
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_1) > RAND_2) {
                    t = z [j][Z_A];
                    z [j][Z_A] = z[i][Z_A];
                    z [i][Z_A] = t;
                }
            }
        }
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_3) < RAND_4) {
                    t = z [j][Z_B];
                    z [j][Z_B] = z[i][Z_B];
                    z [i][Z_B] = t;
                }
            }
        }
        flag = TRUE;
        for (i = 0;  i < MAX_STATES;  i++)
            if ((z[i][Z_A] == z[i][Z_B]) \&amp;\&amp; (z[i][Z_B] == i)) {
                flag = FALSE;
            }

    }
    for (i = 0;  i < MAX_STATES;  i++) {
        a [i] = z [Z_A][i];
        b [i] = z [Z_B][i];
        y [Z_A][i] = rand () % MAX_OUTPUTS;
        y [Z_B][i] = rand () % MAX_OUTPUTS;
    }

return;
}

void printtex (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i, j;
    printf("\documentclass{article}n");
    printf("\usepackage[utf8]{inputenc}n");
    printf("\usepackage{pgf, tikz}n");
    printf("\usetikzlibrary{arrows , automata , positioning}n");
    printf("\begin{document}nn");

    printf("\begin{center}n");
    printf("\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm]n");
    printf("%Knotenn");

    printf("\node (1) [state, thick] {1};n");
    printf("\node (2) [state, thick, right of= 1] {2};n");
    printf("\node (3) [state, thick, above of= 2, right of= 2] {3};n");
    printf("\node (4) [state, thick, above of= 3, right of= 1] {4};nn");

    printf("%Verbindungenn");
    printf("\path[thick,->]n");

    char *leftright [] = {"left", "right"};
    char *abovebelow [] = {"above", "below"};

    for (i = 0;  i < MAX_STATES;  i++) {
            if ((a [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_A, y [Z_A][i], a [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*10+(a[i]-MIN_STATE)*5, leftright [(i>(a [i]-MIN_STATE))\&amp;\&amp;((a [i]-MIN_STATE) != 3)], abovebelow    [((i+1)<=a[i])\&amp;\&amp;(a[i] != 4)], Z_A, y [Z_A][i], a [i]);
            if ((b [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_B, y [Z_B][i], b [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*25+(b[i]-MIN_STATE)*8, leftright [(i<=(b [i]-MIN_STATE)) \&amp;\&amp;((b [i]-MIN_STATE) != 3)], abovebelow [((i+MIN_STATE)>b [i])\&amp;\&amp;(b [i] != 4)], Z_B, y [Z_B][i], b [i]);
    }
    printf(";n");
    printf("\end{tikzpicture}n");
    printf("\end{center}n");
    printf("\end{document}n");

}

int main (int argc, char *argv []) {
    #define CREATE_NEW      0
    #define READ_CSV        1
    #define PRINT_TEX       0
    #define PRINT_CSV       1
    #define PRINT_NO_HELP   0
    #define PRINT_HELP      1

    int b [MAX_STATES];
    int a [MAX_STATES];
    int y [MAX_OUTPUTS][MAX_STATES];
    int argi;
    int createnew_readcsv = CREATE_NEW;
    int printraw_printtex_print_csv = PRINT_CSV;
    int printhelp = PRINT_NO_HELP;

    for (argi = 1;  argi < argc;  argi++) {
        if ((strcmp ("--create-new", argv [argi]) == 0) || (strcmp ("-n", argv [argi]) == 0))
            createnew_readcsv = CREATE_NEW;
        if ((strcmp ("--read-csv", argv [argi]) == 0) || (strcmp ("-s", argv [argi]) == 0))
            createnew_readcsv = READ_CSV;
        if ((strcmp ("--print-csv", argv [argi]) == 0) || (strcmp ("-c", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_CSV;
        if ((strcmp ("--print-tex", argv [argi]) == 0) || (strcmp ("-t", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_TEX;
        if ((strcmp ("--help", argv [argi]) == 0) || (strcmp ("-h", argv [argi]) == 0))
            printhelp = PRINT_HELP;
    }
    if (printhelp == PRINT_HELP) {
        printf ("--create-newn-nnn");
        printf ("--read-csvn-rnn");
        printf ("--print-csvn-cnn");
        printf ("--print-texn-tnn");
        printf ("--helpn-hnn");
        return 2;
    }
    if (createnew_readcsv == CREATE_NEW)
        createnew (a, b, y);
    else if (createnew_readcsv == READ_CSV);
        readcsv (a, b, y);
    if (printraw_printtex_print_csv == PRINT_TEX)
        printtex (a, b, y);
    else if (printraw_printtex_print_csv == PRINT_CSV)
        printcsv (a, b, y);
return 0;
}

// sehen sie den Unterschied

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define MAX_SPECIAL_STATES      3
#define MAX_STATES              4
#define MIN_STATE               1
#define SPECIAL_STATE_1         1
#define SPECIAL_STATE_2         2
#define SPECIAL_STATE_3         3
#define MAX_INPUTS              2
#define MAX_OUTPUTS             2
#define TRUE                    1
#define FALSE                   0
#define Z_A                     0
#define Z_B                     1

void readcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    int j;
    int i1, i2;
    int x1, x2;
    scanf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < MAX_STATES * 2;  ) {
        scanf ("%i,%i,%i,%in", \&amp;i1, \&amp;x1, \&amp;y [Z_A][i], \&amp;a [i]);
        i++;
        scanf ("%i,%i,%i,%in", \&amp;i2, \&amp;x2, \&amp;y [Z_B][i], \&amp;b [i]);
        i++;

/*
        if (x1 != Z_A) {
            printf ("Error - I/On");
            exit (1);
        }
        if (x2 != Z_B) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i1 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i2 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }*/
    }

return;
}

void printcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    printf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < (MAX_STATES);  i++) {
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_A, y [Z_A][i], a [i]);
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_B, y [Z_B][i], b [i]);
    }

return;
}

void createnew (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
#define RAND_1      32
#define RAND_2      16
#define RAND_3      16
#define RAND_4      8

    time_t t;
    int i, j;
    int z [MAX_STATES][MAX_OUTPUTS];
    int flag;

    srand ((unsigned)time (\&amp;t));

    for (i = 0;  i < MAX_STATES;  i++) {
        z [i][Z_A] = i + MIN_STATE;
        z [i][Z_B] = i + MIN_STATE;
    }
    flag = 0;
    while (!flag) {
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_1) > RAND_2) {
                    t = z [j][Z_A];
                    z [j][Z_A] = z[i][Z_A];
                    z [i][Z_A] = t;
                }
            }
        }
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_3) < RAND_4) {
                    t = z [j][Z_B];
                    z [j][Z_B] = z[i][Z_B];
                    z [i][Z_B] = t;
                }
            }
        }
        flag = TRUE;
        for (i = 0;  i < MAX_STATES;  i++)
            if ((z[i][Z_A] == z[i][Z_B]) \&amp;\&amp; (z[i][Z_B] == i)) {
                flag = FALSE;
            }

    }
    for (i = 0;  i < MAX_STATES;  i++) {
        a [i] = z [Z_A][i];
        b [i] = z [Z_B][i];
        y [Z_A][i] = rand () % MAX_OUTPUTS;
        y [Z_B][i] = rand () % MAX_OUTPUTS;
    }

return;
}

void printtex (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i, j;
    printf("\documentclass{article}n");
    printf("\usepackage[utf8]{inputenc}n");
    printf("\usepackage{pgf, tikz}n");
    printf("\usetikzlibrary{arrows , automata , positioning}n");
    printf("\begin{document}nn");

    printf("\begin{center}n");
    printf("\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm]n");
    printf("%Knotenn");

    printf("\node (1) [state, thick] {1};n");
    printf("\node (2) [state, thick, right of= 1] {2};n");
    printf("\node (3) [state, thick, above of= 2, right of= 2] {3};n");
    printf("\node (4) [state, thick, above of= 3, right of= 1] {4};nn");

    printf("%Verbindungenn");
    printf("\path[thick,->]n");

    char *leftright [] = {"left", "right"};
    char *abovebelow [] = {"above", "below"};

    for (i = 0;  i < MAX_STATES;  i++) {
            if ((a [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_A, y [Z_A][i], a [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*10+(a[i]-MIN_STATE)*5, leftright [(i>(a [i]-MIN_STATE))\&amp;\&amp;((a [i]-MIN_STATE) != 3)], abovebelow    [((i+1)<=a[i])\&amp;\&amp;(a[i] != 4)], Z_A, y [Z_A][i], a [i]);
            if ((b [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_B, y [Z_B][i], b [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*25+(b[i]-MIN_STATE)*8, leftright [(i<=(b [i]-MIN_STATE)) \&amp;\&amp;((b [i]-MIN_STATE) != 3)], abovebelow [((i+MIN_STATE)>b [i])\&amp;\&amp;(b [i] != 4)], Z_B, y [Z_B][i], b [i]);
    }
    printf(";n");
    printf("\end{tikzpicture}n");
    printf("\end{center}n");
    printf("\end{document}n");

}

int main (int argc, char *argv []) {
    #define CREATE_NEW      0
    #define READ_CSV        1
    #define PRINT_TEX       0
    #define PRINT_CSV       1
    #define PRINT_NO_HELP   0
    #define PRINT_HELP      1

    int b [MAX_STATES];
    int a [MAX_STATES];
    int y [MAX_OUTPUTS][MAX_STATES];
    int argi;
    int createnew_readcsv = CREATE_NEW;
    int printraw_printtex_print_csv = PRINT_CSV;
    int printhelp = PRINT_NO_HELP;

    for (argi = 1;  argi < argc;  argi++) {
        if ((strcmp ("--create-new", argv [argi]) == 0) || (strcmp ("-n", argv [argi]) == 0))
            createnew_readcsv = CREATE_NEW;
        if ((strcmp ("--read-csv", argv [argi]) == 0) || (strcmp ("-s", argv [argi]) == 0))
            createnew_readcsv = READ_CSV;
        if ((strcmp ("--print-csv", argv [argi]) == 0) || (strcmp ("-c", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_CSV;
        if ((strcmp ("--print-tex", argv [argi]) == 0) || (strcmp ("-t", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_TEX;
        if ((strcmp ("--help", argv [argi]) == 0) || (strcmp ("-h", argv [argi]) == 0))
            printhelp = PRINT_HELP;
    }
    if (printhelp == PRINT_HELP) {
        printf ("--create-newn-nnn");
        printf ("--read-csvn-rnn");
        printf ("--print-csvn-cnn");
        printf ("--print-texn-tnn");
        printf ("--helpn-hnn");
        return 2;
    }
    if (createnew_readcsv == CREATE_NEW)
        createnew (a, b, y);
    else if (createnew_readcsv == READ_CSV);
        readcsv (a, b, y);
    if (printraw_printtex_print_csv == PRINT_TEX)
        printtex (a, b, y);
    else if (printraw_printtex_print_csv == PRINT_CSV)
        printcsv (a, b, y);
return 0;
}

// Ich habe das Problem gefunden, schauen sie genau hin

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define MAX_SPECIAL_STATES      3
#define MAX_STATES              4
#define MIN_STATE               1
#define SPECIAL_STATE_1         1
#define SPECIAL_STATE_2         2
#define SPECIAL_STATE_3         3
#define MAX_INPUTS              2
#define MAX_OUTPUTS             2
#define TRUE                    1
#define FALSE                   0
#define Z_A                     0
#define Z_B                     1

void readcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    int j;
    int i1, i2;
    int x1, x2;
    scanf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < MAX_STATES * 2;  ) {
        scanf ("%i,%i,%i,%in", \&amp;i1, \&amp;x1, \&amp;y [Z_A][i/2], \&amp;a [i]);
        i++;
        scanf ("%i,%i,%i,%in", \&amp;i2, \&amp;x2, \&amp;y [Z_B][i/2-1], \&amp;b [i]);
        i++;

/*
        if (x1 != Z_A) {
            printf ("Error - I/On");
            exit (1);
        }
        if (x2 != Z_B) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i1 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }
        if (i2 != (i+1)) {
            printf ("Error - I/On");
            exit (1);
        }*/
    }

return;
}

void printcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i;
    printf ("Zustand,Eingabe,Ausgabe,Folgezustandn");

    for (i = 0;  i < (MAX_STATES);  i++) {
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_A, y [Z_A][i], a [i]);
        printf ("%i,%i,%i,%in", i+MIN_STATE, Z_B, y [Z_B][i], b [i]);
    }

return;
}

void createnew (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
#define RAND_1      32
#define RAND_2      16
#define RAND_3      16
#define RAND_4      8

    time_t t;
    int i, j;
    int z [MAX_STATES][MAX_OUTPUTS];
    int flag;

    srand ((unsigned)time (\&amp;t));

    for (i = 0;  i < MAX_STATES;  i++) {
        z [i][Z_A] = i + MIN_STATE;
        z [i][Z_B] = i + MIN_STATE;
    }
    flag = 0;
    while (!flag) {
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_1) > RAND_2) {
                    t = z [j][Z_A];
                    z [j][Z_A] = z[i][Z_A];
                    z [i][Z_A] = t;
                }
            }
        }
        for (i = 0;  i < MAX_STATES;  i++) {
            for (j = i + 1;  j < MAX_STATES;  j++) {
                if ((rand () % RAND_3) < RAND_4) {
                    t = z [j][Z_B];
                    z [j][Z_B] = z[i][Z_B];
                    z [i][Z_B] = t;
                }
            }
        }
        flag = TRUE;
        for (i = 0;  i < MAX_STATES;  i++)
            if ((z[i][Z_A] == z[i][Z_B]) \&amp;\&amp; (z[i][Z_B] == i)) {
                flag = FALSE;
            }

    }
    for (i = 0;  i < MAX_STATES;  i++) {
        a [i] = z [Z_A][i];
        b [i] = z [Z_B][i];
        y [Z_A][i] = rand () % MAX_OUTPUTS;
        y [Z_B][i] = rand () % MAX_OUTPUTS;
    }

return;
}

void printtex (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) {
    int i, j;
    printf("\documentclass{article}n");
    printf("\usepackage[utf8]{inputenc}n");
    printf("\usepackage{pgf, tikz}n");
    printf("\usetikzlibrary{arrows , automata , positioning}n");
    printf("\begin{document}nn");

    printf("\begin{center}n");
    printf("\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm]n");
    printf("%Knotenn");

    printf("\node (1) [state, thick] {1};n");
    printf("\node (2) [state, thick, right of= 1] {2};n");
    printf("\node (3) [state, thick, above of= 2, right of= 2] {3};n");
    printf("\node (4) [state, thick, above of= 3, right of= 1] {4};nn");

    printf("%Verbindungenn");
    printf("\path[thick,->]n");

    char *leftright [] = {"left", "right"};
    char *abovebelow [] = {"above", "below"};

    for (i = 0;  i < MAX_STATES;  i++) {
            if ((a [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_A, y [Z_A][i], a [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*10+(a[i]-MIN_STATE)*5, leftright [(i>(a [i]-MIN_STATE))\&amp;\&amp;((a [i]-MIN_STATE) != 3)], abovebelow    [((i+1)<=a[i])\&amp;\&amp;(a[i] != 4)], Z_A, y [Z_A][i], a [i]);
            if ((b [i] - MIN_STATE) == i)
                printf ("(%i) edge [loop] node {%i/%i} (%i)n", i + MIN_STATE, Z_B, y [Z_B][i], b [i]);
            else
                printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i} (%i)n", i + MIN_STATE, (i+1)*25+(b[i]-MIN_STATE)*8, leftright [(i<=(b [i]-MIN_STATE)) \&amp;\&amp;((b [i]-MIN_STATE) != 3)], abovebelow [((i+MIN_STATE)>b [i])\&amp;\&amp;(b [i] != 4)], Z_B, y [Z_B][i], b [i]);
    }
    printf(";n");
    printf("\end{tikzpicture}n");
    printf("\end{center}n");
    printf("\end{document}n");

}

int main (int argc, char *argv []) {
    #define CREATE_NEW      0
    #define READ_CSV        1
    #define PRINT_TEX       0
    #define PRINT_CSV       1
    #define PRINT_NO_HELP   0
    #define PRINT_HELP      1

    int b [MAX_STATES];
    int a [MAX_STATES];
    int y [MAX_OUTPUTS][MAX_STATES];
    int argi;
    int createnew_readcsv = CREATE_NEW;
    int printraw_printtex_print_csv = PRINT_CSV;
    int printhelp = PRINT_NO_HELP;

    for (argi = 1;  argi < argc;  argi++) {
        if ((strcmp ("--create-new", argv [argi]) == 0) || (strcmp ("-n", argv [argi]) == 0))
            createnew_readcsv = CREATE_NEW;
        if ((strcmp ("--read-csv", argv [argi]) == 0) || (strcmp ("-s", argv [argi]) == 0))
            createnew_readcsv = READ_CSV;
        if ((strcmp ("--print-csv", argv [argi]) == 0) || (strcmp ("-c", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_CSV;
        if ((strcmp ("--print-tex", argv [argi]) == 0) || (strcmp ("-t", argv [argi]) == 0))
            printraw_printtex_print_csv = PRINT_TEX;
        if ((strcmp ("--help", argv [argi]) == 0) || (strcmp ("-h", argv [argi]) == 0))
            printhelp = PRINT_HELP;
    }
    if (printhelp == PRINT_HELP) {
        printf ("--create-newn-nnn");
        printf ("--read-csvn-rnn");
        printf ("--print-csvn-cnn");
        printf ("--print-texn-tnn");
        printf ("--helpn-hnn");
        return 2;
    }
    if (createnew_readcsv == CREATE_NEW)
        createnew (a, b, y);
    else if (createnew_readcsv == READ_CSV);
        readcsv (a, b, y);
    if (printraw_printtex_print_csv == PRINT_TEX)
        printtex (a, b, y);
    else if (printraw_printtex_print_csv == PRINT_CSV)
        printcsv (a, b, y);
return 0;
}