Answered step by step
Verified Expert Solution
Question
1 Approved Answer
why wont this print please answer quickly if possible thanks #include #include int i = 0; char array[100]; char temp_hold; //command line arguments int main(int
why wont this print please answer quickly if possible thanks
#include#include int i = 0; char array[100]; char temp_hold; //command line arguments int main(int argc , char *argv[] ) { //fopen is used to open the file FILE *input = fopen(argv[1], "r"); FILE *output = fopen (argv[2], "w"); if (input == NULL) { printf("Error no files found check arguments "); exit(0); } //check the end of file of the input file and goes through the a-z and A-Z and 0- 9 conditions while ((temp_hold = getc(input)) != EOF) { if ((temp_hold >= 'a' && temp_hold <= 'z')) { array[i] = temp_hold; i++; } else if((temp_hold >= 'A' && temp_hold <= 'Z')){ array[i] = temp_hold; i++; } else if((temp_hold >= '0' && temp_hold <= '9')){ array[i] = temp_hold; i++; } else { array[i] = '\0'; //mark the end of the char array fprintf(output, "%s",array); //printing to ouput file. if(temp_hold!='\0') // checking other characters that are not alphanumeric fprintf(output, "%c",temp_hold); i = 0; } } array[i] = '\0'; fprintf(output, "%s", array); fclose(input); fclose(output); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started