#include<stdio.h> 
#include<string.h> 
#include<stdlib.h> 
#define MAX 20 


 
//struct team_info
typedef struct  
{ 
        char team[16]; 
        int played;
    int won;
    int drawn;
    int lost; 
    int goalsf; 
    int goalsa; 
    int goald;
    int points;
    int ID; 
}team_info; 
 
team_info arrdetails[12];
 
 
int print_header(); 
void draw_table (); 
int take_team_input(); 
int take_team_name();
int save_table();
int read_table();
int sort_table();
int num_teams = 0; 
 
 
/************************************************************/ 
/*                Main Function                             */ 
/************************************************************/ 
int main() 
{ 
 
 int option = 0; 
         
 while(option != 7) 
  
 { 
    option = print_header(); 
 
    switch(option) 
    { 
    case 1: /*Enter team */ 
        if (num_teams < MAX) 
        { 
            take_team_name(); 
            break; 
        } 
        else 
        { 
            printf("LEAGUE FULL\n"); 
        } 
                 
    case 2: /*Display table*/ 
        printf("\nLeague Table:\n"); 
        draw_table(); 
        break; 
             
    case 3: /*Match details*/ 
                take_team_input(); 
               break; 
        
    case 4: /*Save File*/ 
                save_table(); 
               break;

    case 5: /*Readfile*/ 
                read_table(); 
               break;    

    case 6: /*Sort Table*/ 
                sort_table(); 
               break;
 
    case 7: /*Exit*/ 
        printf("\n*** FINISHED ***\n"); 
        exit(0); 
          
        default: /*invalid option letter entererd*/ 
            printf("\nInvalid choice, Please try again\n"); 
    } 
   } 
    
  return 0; 
} 
 
/****************************************************************/ 
/*                      Functions                               */ 
/****************************************************************/ 
/****************************************************************/ 
/*                      Print Menu Options                      */ 
/****************************************************************/ 
int print_header() 
{ 
   int a=0; 
   printf("\n****************************"); 
   printf("\n*     Football League    *"); 
   printf("\n****************************\n"); 
   printf("\n1.\tEnter a New Team\n"); 
   printf("\n2.\tDisplay Current Table\n"); 
   printf("\n3.\tEnter Match Details\n");
   printf("\n4.\tSave to Filels\n");
   printf("\n5.\tRead from File File\n");
   printf("\n6.\tSort Table By Points\n"); 
   printf("\n7.\tExit System\n"); 
   printf("\nPlease Enter Your Choice: \n"); 
   scanf("%d", &a); 
   return a; 
} 
 
 
/****************************************************************/ 
/*            (1) Enters Team Name            */ 
/****************************************************************/ 
int take_team_name() 
{ 
 
     char teamd[16]; 
 
         printf("\nName:\n>"); 
          
         scanf("%s", teamd); 
          
         strcpy(arrdetails[num_teams].team, teamd); 
          
         arrdetails[num_teams].played = 0;

     arrdetails[num_teams].won = 0;

     arrdetails[num_teams].drawn = 0;

     arrdetails[num_teams].lost = 0; 
          
     arrdetails[num_teams].goalsf = 0; 
          
     arrdetails[num_teams].goalsa = 0; 
          
     arrdetails[num_teams].goald = 0;

     arrdetails[num_teams].points = 0;

         arrdetails[num_teams].ID = num_teams; 
 
         num_teams++; 
          
         return 0; 
 
 } 
 
/****************************************************************/ 
/*          (2)Enter Match Details            */ 
/****************************************************************/ 
int take_team_input() 
{ 
       char team[16];
 
       int ID = 0; 
    int player1 = 0;
    int player2 = 0;
    int score1 = 0;
    int score2 = 0; 

    int i;
 
        printf("\n%2s %-16s\n","ID","Team Name");
 
    //takes home and away team ID and score
 
           for (i = 0; i < num_teams; ++i)
 
    {
            strcpy(team, arrdetails[i].team); 

            ID = arrdetails[i].ID; 

            printf("%2d %-16s\n", ID, team);
        } 


            printf("\nSelect Home Team\n>"); 

            scanf("%d", &player1); 

            printf("\nEnter their Score\n>");
 
            scanf("%d", &score1); 

            printf("\nSelect Away Team\n>"); 

            scanf("%d", &player2);
 
            printf("\nEnter their Score\n>"); 

            scanf("%d", &score2); 

    // works out played etc if draw
 
        if (score1 == score2)
 
    { 

                arrdetails[player1].played++; 

                arrdetails[player2].played++;
 
                arrdetails[player1].goalsf = arrdetails[player1].goalsf + score1; 

                arrdetails[player2].goalsf = arrdetails[player2].goalsf + score2;
 
                arrdetails[player1].goalsa = arrdetails[player1].goalsa + score2; 

                arrdetails[player2].goalsa = arrdetails[player2].goalsa + score1;
 
                arrdetails[player1].points++;
 
                arrdetails[player2].points++;
        
        arrdetails[player1].drawn++;

        arrdetails[player2].drawn++;
 
    } 
 


    // works out played etc if home team wins 

    if (score1 > score2) 

    {
 
                arrdetails[player1].played++; 

                arrdetails[player2].played++; 

                arrdetails[player1].goalsf = arrdetails[player1].goalsf + score1; 

                arrdetails[player2].goalsf = arrdetails[player2].goalsf + score2;
 
                arrdetails[player1].goalsa = arrdetails[player1].goalsa + score2; 

                arrdetails[player2].goalsa = arrdetails[player2].goalsa + score1;
 
                arrdetails[player1].points += 3;

        arrdetails[player1].won++;

        arrdetails[player2].lost++; 

    } 
 


    // works out played etc if away team wins 

    if (score1 < score2) 

    {
 
                arrdetails[player1].played++; 

                arrdetails[player2].played++;
 
                arrdetails[player1].goalsf = arrdetails[player1].goalsf + score1; 

                arrdetails[player2].goalsf = arrdetails[player2].goalsf + score2; 

                arrdetails[player1].goalsa = arrdetails[player1].goalsa + score2; 

                arrdetails[player2].goalsa = arrdetails[player2].goalsa + score1; 

                arrdetails[player2].points += 3;

        arrdetails[player1].lost++;

        arrdetails[player2].won++; 

    } 


        return 0; 
} 
 
/****************************************************************/ 
/*                 (3) Displays the current teams               */ 
/*                 And Info                           */ 
/****************************************************************/ 
void draw_table () 
{ 
    int i;
    // Prints out Headers    
    printf("Id Team Played Won Lost Drawn GoalsF GoalsA GoalD Points\n"); 
        // Displays Sorted League Table 
    for ( i = 0; i < MAX; i++ ) 
        { 
         printf("%d \t %10s \t %d \t %d \t %d \t \t %d\n",arrdetails[i].ID,arrdetails    [i].team,arrdetails[i].played,arrdetails[i].won,arrdetails[i].lost,arrdetails[i].drawn,arrdetails[i].goalsf,arrdetails[i].goalsa,arrdetails[i].goald,arrdetails[i].points); 
        } 
}

/****************************************************************/ 
/*                   (4) Save To A File                         */ 
/****************************************************************/ 
int save_table () 
{ 
int i; 

    FILE *stream;
 
    if(stream = NULL) 
    { 
          printf("Unable to open\n"); 
        return -1; 
    } 
    else 
    { 
          printf("Save: ");     
    } 
 
    for(i=0; i< 12+1; i++) 
    { 
          fwrite(&arrdetails[i], sizeof(team_info), 1, stream); 
        printf("#"); 
    } 
    fclose(stream); 
    printf("\n"); 
    return 0;     
}

/****************************************************************/ 
/*                       (4) Read From A File                  */ 
/****************************************************************/ 
int read_table () 
{ 
int i = 0; 

    FILE *stream;
 
    if(stream = NULL) 
    { 
        return -1; 
        printf("Failed to open file"); 
    } 
    else 
    { 
        printf("Read: "); 
    } 
    while(fread(&arrdetails[i] sizeof(team_info), 1, stream)) 
    { 
         i++; 
        printf("#"); 
    } 
    printf("\n"); 
    fclose(stream); 
    return i;     
}

/****************************************************************/ 
/*                      (6) Sort League Table               */ 
/****************************************************************/ 
int sort_table () 
{ 
    //FILL IN HERE LATER     
}

cannot get the file to save and read keep getting segmentation fault (core dumped) errors

its probs somthing very simple as im not too good at c, everything worked before i added the bits to read and write

hope someone can help

regards Dan

line 355 is missing a comma. Your compiler should have given you errors on that line. Never ever ignore compile errors or warnings.

ok added the comma, it compiles but getting the

segmentation fault (core dumped) error when i try and run commands 4. and 5.

:(

The comma is necessary to separate the first and second parameters to fread() function.

yep ok well ive put that comma in and still not working

> FILE *stream;
>
> if(stream = NULL)
Where is the opening of the file?
You're using = where you should be using ==

In short, your FILE pointer is a complete mess, no wonder fwrite and fread complain.

ok sorted out the code and it goes as follows...

#include<stdio.h> 
#include<string.h> 
#include<stdlib.h> 
#define MAX 12

 
//struct team_info
typedef struct  
{ 
    int ID;
    char team[16]; 
    int played;
    int won;
    int drawn;
    int lost; 
    int goalsf; 
    int goalsa; 
    int goald;
    int points; 
}team_info; 
 
team_info arrdetails[12];
 
 
int print_header(); 
void draw_table (); 
int take_team_input(); 
int take_team_name();
void save_table(team_info arrdetails[],int);
void read_table(team_info arrdetails[],int);
int sort_table();
int num_teams = 0;
int compare(team_info arrdetails[], int, char[]);
 
 
/************************************************************/ 
/*                Main Function                             */ 
/************************************************************/ 
int main() 
{ 
 char teamd[16]; 
 int option = 0; 
         
 while(option != 7) 
  
 { 
    option = print_header(); 
 
    switch(option) 
    { 
    case 1: /*Enter team */ 
        if (num_teams < MAX) 
        { 
            take_team_name(); 
            break; 
        } 
        else 
        { 
            printf("arrdetails FULL\n"); 
        } 
                 
    case 2: /*Display table*/ 
        printf("\narrdetails Table:\n"); 
        draw_table(); 
        break; 
             
    case 3: /*Match details*/ 
                take_team_input(); 
               break; 
        
    case 4: /*Save File*/ 
                save_table(arrdetails, num_teams); 
               break;
    case 5: /*Readfile*/ 
                read_table(arrdetails, num_teams); 
               break;    
    case 6: /*Sort Table*/ 
                sort_table(); 
               break;
 
    case 7: /*Exit*/ 
        printf("\n*** FINISHED ***\n"); 
        exit(0); 
          
        default: /*invalid option letter entererd*/ 
            printf("\nInvalid choice, Please try again\n"); 
    } 
   } 
    
  return 0; 
} 
 
/****************************************************************/ 
/*                      Functions                               */ 
/****************************************************************/ 
/****************************************************************/ 
/*                      Print Menu Options                      */ 
/****************************************************************/ 
int print_header() 
{ 
   int a=0; 
   printf("\n****************************"); 
   printf("\n*     Football arrdetails    *"); 
   printf("\n****************************\n"); 
   printf("\n1.\tEnter a New Team\n"); 
   printf("\n2.\tDisplay Current Table\n"); 
   printf("\n3.\tEnter Match Details\n");
   printf("\n4.\tSave to File\n");
   printf("\n5.\tRead from File\n");
   printf("\n6.\tSort Table By Points\n"); 
   printf("\n7.\tExit System\n"); 
   printf("\nPlease Enter Your Choice: \n"); 
   scanf("%d", &a); 
   return a; 
} 
 
 
/****************************************************************/ 
/*            (1) Enters Team Name            */ 
/****************************************************************/ 
int take_team_name() 
{ 
 
     char teamd[16]; 
 
     printf("\nName:\n>"); 
          
     scanf("%s", teamd); 
          
     strcpy(arrdetails[num_teams].team, teamd); 
          
     arrdetails[num_teams].played = 0;
     arrdetails[num_teams].won = 0;
     arrdetails[num_teams].drawn = 0;
     arrdetails[num_teams].lost = 0; 
          
     arrdetails[num_teams].goalsf = 0; 
          
     arrdetails[num_teams].goalsa = 0; 
          
     arrdetails[num_teams].goald = 0;
     arrdetails[num_teams].points = 0;
         arrdetails[num_teams].ID = num_teams; 
 
         num_teams++; 
          
         return 0; 
 
 } 
 
/****************************************************************/ 
/*          (2)Enter Match Details            */ 
/****************************************************************/ 
int take_team_input() 
{ 
    char teamd[16];
 
    int ID = 0; 
    int player1 = 0;
    int player2 = 0;
    int score1 = 0;
    int score2 = 0; 
    int i;
 
    printf("\n%2s %-16s\n","ID","Team Name");
 
    //takes home and away team ID and score
 
    for (i = 0; i < num_teams; ++i)
 
      {
            strcpy(teamd, arrdetails[i].team); 
            ID = arrdetails[i].ID; 
            printf("%2d %-16s\n", ID, teamd);
       } 
     player1 = -1;
            printf("\nSelect Home Team\n>"); 
     gets(teamd);
     player1 = compare(arrdetails, num_teams, teamd);

     if (player1 == -1)
  {
      while(player1 == -1)
      {
   gets(teamd);
   player1 = compare(arrdetails, num_teams,teamd);
      }
  }
            //scanf("%d", &player1); 
            printf("\nEnter their Score\n>");
            scanf("%d", &score1); 

            printf("\nSelect Away Team\n>"); 
     gets(teamd);
     player2 = compare(arrdetails, num_teams, teamd);
     if (player2 == -1)
  {
      while(player2 == -1)
      {
   gets(teamd);
   player2 = compare(arrdetails, num_teams,teamd);
      }
  }

            //scanf("%d", &player2);
 

            printf("\nEnter their Score\n>"); 
            scanf("%d", &score2); 
    // works out played etc if draw
 
        if (score1 == score2)
 
    { 
                arrdetails[player1].played++; 
                arrdetails[player2].played++;
 
                arrdetails[player1].goalsf = arrdetails[player1].goalsf + score1; 
                arrdetails[player2].goalsf = arrdetails[player2].goalsf + score2;
 
                arrdetails[player1].goalsa = arrdetails[player1].goalsa + score2; 
                arrdetails[player2].goalsa = arrdetails[player2].goalsa + score1;
 
                arrdetails[player1].points++;
 
                arrdetails[player2].points++;
        
        arrdetails[player1].drawn++;
        arrdetails[player2].drawn++;
 
    } 
 

    // works out played etc if home team wins 
    if (score1 > score2) 
    {
 
                arrdetails[player1].played++; 
                arrdetails[player2].played++; 
                arrdetails[player1].goalsf = arrdetails[player1].goalsf + score1; 
                arrdetails[player2].goalsf = arrdetails[player2].goalsf + score2;
 
                arrdetails[player1].goalsa = arrdetails[player1].goalsa + score2; 
                arrdetails[player2].goalsa = arrdetails[player2].goalsa + score1;
 
                arrdetails[player1].points += 3;
        arrdetails[player1].won++;
        arrdetails[player2].lost++; 
    } 
 

    // works out played etc if away team wins 
    if (score1 < score2) 
    {
 
                arrdetails[player1].played++; 
                arrdetails[player2].played++;
 
                arrdetails[player1].goalsf = arrdetails[player1].goalsf + score1; 
                arrdetails[player2].goalsf = arrdetails[player2].goalsf + score2; 
                arrdetails[player1].goalsa = arrdetails[player1].goalsa + score2; 
                arrdetails[player2].goalsa = arrdetails[player2].goalsa + score1; 
                arrdetails[player2].points += 3;
        arrdetails[player1].lost++;
        arrdetails[player2].won++; 
    } 

        return 0; 
} 
 
/****************************************************************/ 
/*                 (3) Displays the current teams               */ 
/*                 And Info                           */ 
/****************************************************************/ 
void draw_table () 
{ 
    int i;
    // Prints out Headers    
    printf("Id\tTeam\tPlayed\tWon\tLost\tDrawn\tGoalsF\tGoalsA\tGoalD\tPoints\n"); 
        // Displays Sorted arrdetails Table 
    for ( i = 0; i < MAX; i++ ) 
        { 
         printf("%d\t%s\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",arrdetails[i].ID,arrdetails[i].team,arrdetails[i].played,arrdetails[i].won,arrdetails[i].lost,arrdetails[i].drawn,arrdetails[i].goalsf,arrdetails[i].goalsa,arrdetails[i].goald,arrdetails[i].points); 
        } 
}
/****************************************************************/ 
/*                   (4) Save To A File                         */ 
/****************************************************************/ 
void save_table (team_info arrdetails[],int num_teams) 
{ 
    int i; 
    FILE *stream;
    char fileName[20];
 
    printf("\nEnter File Name:\n");
    scanf("%s", fileName, "w");
    
    stream = fopen(fileName, "w");
    if(stream == NULL) 
    { 
        printf("\nUnable to open %s", fileName); 
        exit(1);
    } 
    
    for(i=-1; i< 12; i++) 
    { 
        fprintf(stream,"\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%s\n",arrdetails[i].ID,arrdetails[i].played,arrdetails[i].won,arrdetails[i].drawn,arrdetails[i].lost,arrdetails[i].goalsf,arrdetails[i].goalsa,arrdetails[i].goald,arrdetails[i].points,arrdetails[i].team); 
        printf("#"); 
    } 
    fprintf(stream,"\t%d\n",num_teams);
    fclose(stream);    
}
/****************************************************************/ 
/*                       (4) Read From A File                  */ 
/****************************************************************/ 
void read_table (team_info arrdetails[], int num_teams) 
{ 
int i;
char line[81], fileName[21];
char dummy; 
FILE *instream;
printf("\nEnter the name of the file you want to load:\n");
scanf("%s", fileName);
printf("%s OK\n", fileName);
instream = fopen(fileName, "r");
 
    if(instream == NULL) 
    { 
          printf("\nThe file name does not exist!", fileName);
          exit (1); 
    } 
    fscanf(instream,"%d,%c",&num_teams,&dummy);
            for (i=-1; i<12; i++)
                {
                fgets(line, 80, instream);
  sscanf(line,"%d%d%d%d%d%d%d%d%d%s",&arrdetails[i].ID,&arrdetails[i].played,&arrdetails[i].won,&arrdetails[i].drawn,&arrdetails[i].lost,&arrdetails[i].goalsf,&arrdetails[i].goalsa,&arrdetails[i].goald,&arrdetails[i].points,&arrdetails[i].team);  
  } 
}
/****************************************************************/ 
/*                      (6) Sort arrdetails Table               */ 
/****************************************************************/ 
int sort_table()
{
 team_info temp;
 for (int i = 0; i < (num_teams - 1); ++i) {
  for (int j = 0; j < (num_teams - 1); ++j) {
   if (arrdetails[j].goalsf < arrdetails[j+1].goalsf) {
    temp = arrdetails[j];
    arrdetails[j] = arrdetails[j+1];
    arrdetails[j+1] = temp;
   }
  }
 }
 
 for (int i = 0; i < (num_teams - 1); ++i) {
  for (int j = 0; j < (num_teams - 1); ++j) {
   if ((arrdetails[j].goalsf - arrdetails[j].goalsa) < (arrdetails[j+1].goalsf - arrdetails[j+1].goalsa)) {
    temp = arrdetails[j];
    arrdetails[j] = arrdetails[j+1];
    arrdetails[j+1] = temp;
   }
  }
 }
 
 for (int i = 0; i < (num_teams - 1); ++i) {
  for (int j = 0; j < (num_teams - 1); ++j) {
   if (arrdetails[j].points < arrdetails[j+1].points) {
    temp = arrdetails[j];
    arrdetails[j] = arrdetails[j+1];
    arrdetails[j+1] = temp;
    
    
   }
  }
 }

 for (int i = 0; i < (num_teams); ++i)
  arrdetails[i].ID = i;
 return 0;
}
/****************************************************************/ 
/*                      Comparing the strings              */ 
/****************************************************************/ 
int compare (team_info arrdetails[], int num_teams, char teamd [16]) 
{ 
    int H;
 
 for(H=0;H<num_teams;H++)
 {
   if (strcmp(arrdetails[H].team, teamd) == 0)
  {
   return H;
  }
 }
 return -1;    
}

all works apart from when i enter anything else apart from a number in the menu selection it messes up the code.

also would it be possable to store teams with a space for example "stoke city" and then recall them by typing "stoke city" as at the moment i can only use single strings such as "stoke"

don't use scanf() in line 128 -- use fgets() instead which will take everything you type on the keyboard until the input buffer is filled up.

fgets(teamd, sizeof(teamd), stdin);
// strop off the '\n'
if( teamid[strlen(temid)-1] == '\n')
   teamid[strlen(temid)-1] = 0;

And that raises another point -- never ever at any time any place use gets() function because it does not check on the input buffer size and allows you to scribble all over the program's memory. Use fgets() instead, as illustrated above. Yes I know its a pain in the a** to trim off the '\n', but that is safer than corrupting memory.

// strop off the '\n'
if( teamid[strlen(temid)-1] == '\n')
teamid[strlen(temid)-1] = 0;

just a bit confused on how to add this to the code, ive managed to add the first bit but with the "teamid" and "temid" its saying that the statement is not declared.

thanks for your help again im very thankful

// strop off the '\n'
if( teamid[strlen(temid)-1] == '\n')
teamid[strlen(temid)-1] = 0;

just a bit confused on how to add this to the code, ive managed to add the first bit but with the "teamid" and "temid" its saying that the statement is not declared.

thanks for your help again im very thankful

you need to recognize and correct the mispellings in my post when you type (or copy/paste) it into your program. When your compiler gives you an error message you have to look at the line, find the problem, then correct and recompile.

Salem says there are compilers that detect such errors. But I suppose you don't have one.

>
>> FILE *stream;
>> if(stream = NULL)
You're using = where you should be using ==

As a good coding practice some ppl (including me) follow a guideline that while comparing a constant with a variable write the condition as
( constant == variable )
instead of
( variable == constant )

This way if you have a typo like (constant = variable), it'll be flagged as a compiler error.

In your case you would write:
if( NULL == stream )

> As a good coding practice
That's debatable.
http://c-faq.com/style/revtest.html

It's a special case of a special case.

For example, it only works for ==. Though for some bizarre reason, some people apply it to other ops as well, say turning if ( i < N ) into a very strange looking if ( N > i ) It only works when the left hand side can be an l-value and the right hand side is const. if ( strcmp("hello","world") = 0 ) will draw another kind of error anyway, so there would be nothing to be gained from swapping these over.

What happens when you have to compare two variables for equality?
Oops, the safety net is GONE and you're forced to remember how to do it properly anyway.

To my mind, it wastes the time of people who have to pause to figure out what the code does because it's different from common idioms, and there's always a chance that people will screw it up. I've had personal experience of the operand swappers turning if ( i < N ) into if ( N < i ) because they forgot to swap the operator when they (needlessly) swapped the operands. If all you're going to do is trade one bug for another, you've gotta ask yourself what it is you're getting.

Basically, it is not a free lunch. In attempting to solve one problem, you're just opening the door to add others.

Getting a compiler which will warn you (or better yet, lint) would be my preferred suggestion.
$ gcc -W -Wall -ansi -pedantic -O2 foo.c
foo.c: In function `main':
foo.c:6: warning: suggest parentheses around assignment used as truth value

Comments
thanks for the info --joeprogrammer

I sort of agree with Salem, I always have to study and think more about code whenever I see if( N < i) because to me its not the natural way to thin -- I normally think is i greater than 0?, not is 0 less than i. I understand the reason for coding backwards like that, and would probably eventually get used to it. There are not many compilers that have options to detect the reverse. VC++ 2005 Express doesn't even produce a warning on its hightest level for this code

int i = 10;
    if(i = 5)
    {
        i = 0;
    }

I sort of agree with Salem, I always have to study and think more about code whenever I see if( N < i)

Well I wasn't gonna reply to Salem's post but now that you've also posted, so I'll say this:
I agree that for anything else than equality it becomes not only unreadable but unwritable as well.
So I'll rephrase what I said earlier: "....comparing a constant with a variable for equality write the condition as...."

Coming to the other issue Salem mentioned
>> What happens when you have to compare two variables for equality?
>> Oops, the safety net is GONE and you're forced to remember how to do it properly anyway.
True. But 1. It doesn't mean you don't use it for const vs. variable case and 2. I never said that you this would detect some errors in variable vs. variable comparision by this technique.

>> It only works when the left hand side can be an l-value and the right hand side is const.

if ( strcmp("hello","world") = 0 )

>> will draw another kind of error anyway, so there would be nothing to be gained from swapping these over.
Sorry but I didn't get what does this meant? You'll get a compiler error for this stmt. L-val needed. Which is exactly what we want.

This article has been dead for over six months. Start a new discussion instead.