I am writing a program that receive maximum of 25 line of string each has 20 characters maximum. The program will print the smallest and the largest string. However the following program gives me Segmentation fault (core dumped) :(( It looks simple but i have no idea what went wrong....
Can anyone help me out??
	
							
						
					Can anyone help me out??
Code:
	#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX_INPUT 25
#define MAX_CHAR 20
int main(void)
{
	int t, i, j;
	
	char text[MAX_INPUT][MAX_CHAR];
	
	char smallest[0][MAX_CHAR], largest[0][MAX_CHAR];
  
	printf("Enter 4 characters to quit. \n");
	for(t=0; t<MAX_INPUT; t++)
	{
		printf("Enter word %d: ", t);
		gets(text[t]);
		if(strlen(text[t])==4) break;
	}
	
	for(i=0; i<t; i++)
	{
		for(j=0; text[i][j]; j++)
		{
				if(text[i][j]<smallest[0][MAX_CHAR])
				{
					text[i][j]=smallest[0][MAX_CHAR];
				}
				if(text[i][j]>largest[0][MAX_CHAR])
				{
					text[i][j]=largest[0][MAX_CHAR];
				}
		}
	}
	printf("Smallest word: %s\n", smallest[0][MAX_CHAR]);
	printf("Largest word: %s\n", largest[0][MAX_CHAR]);
  
	return EXIT_SUCCESS;
}
Comment