Finde meinen Fehler nicht...

KingBrick

Grünschnabel
Ist denk ich nur ne kleine sache aber ich such schon ne ganze weile!
PHP:
///////////////////////////////


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//-------Prototypen----------\\
//void insert();
//void toScreen();

//--------Strukturen---------\\
typedef struct werte {
        int val;
        } WERT;

typedef struct zahl {
               WERT VAL;
               struct zahl *next;
        } liste_t;
//--------Startwerte---------\\        
liste_t *first = NULL;



//---------Funktionen--------\\
void insert()
{
     int value;
     liste_t *zeiger;
     liste_t *zeiger1;
     
     printf("Bitte geben sie eine Zahl ein:");
     scanf("%i",&value);
     zeiger = malloc(sizeof(liste_t));
     
     if(first == NULL)
     {
          zeiger->VAL.val = value;
          zeiger->next = NULL;
          
          }
          
     else
     {
          zeiger1 = first;
          if(value <= zeiger->VAL.val){
               zeiger1->VAL.val = value;
               zeiger1->next = first;
               first = zeiger1;
               }
          else
          {
               for(zeiger=first;zeiger != NULL;zeiger=zeiger->next)
               {
                                       if(value >=zeiger->VAL.val)
                                       {
                                            if(zeiger->next == NULL || value <= zeiger->next->VAL.val)
                                            {
                                                            zeiger1->VAL.val = value;
                                                            zeiger1->next = zeiger->next;
                                                            zeiger->next = zeiger;
                                                            break;
                                                            }
                                            }
                     
                     }
               }
          }
             
     }

void toScreen()
{
     liste_t *show;
     printf("//--------Zahl-------\\");
     for(show=first; show != NULL; show = show->next){
                     printf("----%i----\n",show->VAL.val);
                     } 
     printf("\n\n\n");
     }
     
     

//--------Main Funktion------\\
int main()
{
 int wahl;
 int dname;

 do{
	 printf("\n\n1 : Eingabe\n");
	 printf("2 : Ausgabe\n");
	 printf("3 : Name löschen\n");

	 printf("9 : Ende\n");
	 printf("Ihre Wahl : ");
	 scanf("%d",&wahl);
	 getchar();
	 switch(wahl)
	   {
		  case 1 : insert();
		     	   break;
		  case 2 : toScreen();
		   	 	   break;
		  //case 3 : printf("Welchen Namen wollen sie löschen : ");
			//	   scanf("%i",&dname);
				//   erase();
				  // break;
		  case 9 : break;
		  default: printf("Falsche Eingabe\n");
	  }
	 }while(wahl != 9);

 return 0;
}
Ich check nicht was er hat...
Fehlermedungen:
praktikum6zahlen.c:20: error: syntax error before '}' token
praktikum6zahlen.c:20: warning: data definition has no type or storage class
praktikum6zahlen.c:23: error: syntax error before "WERT"
praktikum6zahlen.c:23: warning: no semicolon at end of struct or union
praktikum6zahlen.c:25: error: syntax error before '}' token
praktikum6zahlen.c:25: warning: data definition has no type or storage class
praktikum6zahlen.c:33: error: syntax error before '{' token
praktikum6zahlen.c:35: warning: data definition has no type or storage class
praktikum6zahlen.c:36: error: syntax error before '*' token
praktikum6zahlen.c:36: warning: data definition has no type or storage class
praktikum6zahlen.c:38: error: syntax error before string constant
praktikum6zahlen.c:38: error: conflicting types for 'printf'
praktikum6zahlen.c:38: note: a parameter list with an ellipsis can't match an empty parameter name list declaration
praktikum6zahlen.c:38: error: conflicting types for 'printf'
praktikum6zahlen.c:38: note: a parameter list with an ellipsis can't match an empty parameter name list declaration
praktikum6zahlen.c:38: warning: data definition has no type or storage class
praktikum6zahlen.c:39: error: syntax error before string constant
praktikum6zahlen.c:39: error: conflicting types for 'scanf'
praktikum6zahlen.c:39: note: a parameter list with an ellipsis can't match an empty parameter name list declaration
praktikum6zahlen.c:39: error: conflicting types for 'scanf'
praktikum6zahlen.c:39: note: a parameter list with an ellipsis can't match an empty parameter name list declaration
praktikum6zahlen.c:39: warning: data definition has no type or storage class
praktikum6zahlen.c:40: error: conflicting types for 'zeiger'
praktikum6zahlen.c:35: error: previous declaration of 'zeiger' was here
praktikum6zahlen.c:40: warning: initialization makes integer from pointer without a cast
praktikum6zahlen.c:40: error: initializer element is not constant
praktikum6zahlen.c:40: warning: data definition has no type or storage class
praktikum6zahlen.c:42: error: syntax error before "if"
praktikum6zahlen.c:55: warning: initialization makes integer from pointer without a cast
praktikum6zahlen.c:55: error: initializer element is not constant
praktikum6zahlen.c:55: warning: data definition has no type or storage class
praktikum6zahlen.c:56: error: syntax error before '}' token
praktikum6zahlen.c:59: error: redefinition of 'zeiger'
praktikum6zahlen.c:40: error: previous definition of 'zeiger' was here
praktikum6zahlen.c:59: error: redefinition of 'zeiger'
praktikum6zahlen.c:40: error: previous definition of 'zeiger' was here
praktikum6zahlen.c:59: error: invalid type argument of `->'
praktikum6zahlen.c:59: error: syntax error before ')' token
praktikum6zahlen.c: In function `toScreen':
praktikum6zahlen.c:80: error: `show' undeclared (first use in this function)
praktikum6zahlen.c:80: error: (Each undeclared identifier is reported only once
praktikum6zahlen.c:80: error: for each function it appears in.)
praktikum6zahlen.c: At top level:
praktikum6zahlen.c:92: error: syntax error before '{' token
praktikum6zahlen.c:96: error: syntax error before "do"
praktikum6zahlen.c:98: error: syntax error before string constant
praktikum6zahlen.c:98: warning: data definition has no type or storage class
praktikum6zahlen.c:99: error: syntax error before string constant
praktikum6zahlen.c:99: warning: data definition has no type or storage class
praktikum6zahlen.c:101: error: syntax error before string constant
praktikum6zahlen.c:101: warning: data definition has no type or storage class
praktikum6zahlen.c:102: error: syntax error before string constant
praktikum6zahlen.c:102: warning: data definition has no type or storage class
praktikum6zahlen.c:103: error: syntax error before string constant
praktikum6zahlen.c:103: warning: data definition has no type or storage class
praktikum6zahlen.c:104: warning: data definition has no type or storage class
praktikum6zahlen.c:105: error: syntax error before "switch"
make.exe: *** [praktikum6zahlen.o] Error 1
 
Ist denk ich nur ne kleine sache aber ich such schon ne ganze weile!

Wenn Du ne vernünftige IDE mit Syntax Highlighting benutzen würdest hättest Du den Fehler sofort sehen können.

Die meisten Leute geben sich mit einfachen Kommentarzeilen zufrieden wie

Code:
// Das ist ein einzeiliger Kommentar
/* Das ist ein old Skool Kommentar */

Ich weis nicht woher Du deine "coole" Idee hast solche Kommentare zu machen:
Code:
//  Supercoole Kommentare \\

aber das ist der Fehler... ein "\" am Ende der Zeile hat die Bedeutung für den Compiler das er den Zeilenumbruch ignoriert und sozusagend zwei Zeilen zu einer zusammenfasst. Das benutzt man z.B. in mehrzeiligen Makros.

Also, wenn DU schreibst:

Code:
///---------Funktionen--------\\
void insert()
{

erscheint das für den Compiler als

Code:
///---------Funktionen--------void insert()
{

Mit andern Worten, Du hast all deine Funktionsdefinitionen auskommentiert...
 
danke... ist mir auch schon aufgefallen... war nen dummer fehler ich weiß... was will man machen... Ich denke sowas passiert mir nie wieder ^^
*peinlich*
 
Zurück