Q: For loop trouble across compilers I am having trouble. My program seems to work fine on DEV C++,but on Xcode the last For loop doesn't know when to stop. any help?
#include <stdlib.h>
#include <stdio.h>           
#include <time.h>
#include <string.h>          

void strip_newline(char *str,int size)
{
    int i;
    for(i=0;i<size;++i)
    {
        if(str[i]=='\n')
        {
            str[i]='\0';
            return;
        }
    }
}

int main()    
{
    int randomnumber; 
    int max;           
    int tall;        
    char name[40][tall]; 
    char seat[40][tall]; 
    int count;           
    int currentcount;
    int flag;

    srand( time(NULL) ); 
    printf("Enter total number of students: "); 
    scanf("%d",&max); 
    getchar();        
    tall=max+1;       
    randomnumber=rand()% max +1; 
    printf("This is your random number\n %d \n",randomnumber); 
    printf("Enter your students names and press enter after each name:\n "); 

    fgets(name[0],40,stdin); 
    strip_newline(name[0],40); 

    for(count=1; count < max; count++ )
    {    
        printf("Please enter next name\n ");
        fgets(name[count],40,stdin);  
        strip_newline(name[count],40);
    }

    count=-1;

    do {
        randomnumber=rand()% max;
        flag=0;
        for(currentcount=0; currentcount<max; currentcount++)
        {
            if(strcmp(name[randomnumber],seat[currentcount])==0)
            {
               flag=1;
            }
            else
            {
            }
        }
        if(flag==0)
        {
            strcpy(seat[count],name[randomnumber]);
            count++;
        }
        else
        {
        }
    }
    while (count != max);

    for(count=0; count < max; count++)
    {
        printf("%s sits in seat %d\n",seat[count],count+1);
    }

    getchar();
    return 0; 
}


A: Your problem is in these lines:
int tall;        
char name[40][tall]; 
char seat[40][tall]; 

as tall is not initialized (not given a value), it is unknown how large your 40 arrays will become. It could be anything between 0 and a very large number, or even 'blow-up-in-your-face' as the behaviour is formally undefined. The later assignment to tall will not magically resize the arrays for you.
The solution is to re-arrange your code such that the arrays are not declared until you have sufficient information about their size. Also, given how you use them, you seem to want tall arrays of 40 characters, not 40 arrays of tall characters, so you need to swap the dimensions:
//...
printf("Enter total number of students: "); 
scanf("%d",&max); 
getchar();        
tall=max+1;       
char name[tall][40]; 
char seat[tall][40]; 
//...

