Question: PLEASE EXPLAIN HOW EVERYTHING IN THE NUM _ SUBSTRING METHOD WORKS AND WHAT THEY MEAN!! #include #include #include #include #define MAX 1 0 2 4

PLEASE EXPLAIN HOW EVERYTHING IN THE NUM_SUBSTRING METHOD WORKS AND WHAT THEY MEAN!!
#include
#include
#include
#include
#define MAX 10240
#define NUM_THREADS 10
int n1,n2;
char *s1,*s2;
FILE *fp;
int countArray[NUM_THREADS]={0};
//read input file and generate string s1/s2 and length n1/n2
int readf(FILE *fp)
{
if((fp=fopen("strings.txt","r"))==NULL){
printf("ERROR: can't open string.txt!
");
return 0;
}
s1=(char *)malloc(sizeof(char)*MAX);
if(s1==NULL){
printf("ERROR: Out of memory!
");
return -1;
}
s2=(char *)malloc(sizeof(char)*MAX);
if(s1==NULL){
printf("ERROR: Out of memory
");
return -1;
}
/*read s1 s2 from the file*/
s1=fgets(s1, MAX, fp);
s2=fgets(s2, MAX, fp);
n1=strlen(s1); /*length of s1*/
n2=strlen(s2)-1; /*length of s2*/
if(s1==NULL || s2==NULL || n1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!