Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this . Modify the code to accept some number of letters entered by the user and print the largest letter (where

I need help with this . Modify the code to accept some number of letters entered by the user and print the largest letter (where Z is assumed to be > A) and smallest letter (where A < Z). Use toupper() to convert the user input prior to the comparisons in void min_max (1) if you do not convert everything to upper what is the problem with the comparison between 'a' and 'A' ie which is bigger and why? (hint: see ascii chart also in the Lab 6 folder) (2) what does the value argc tell you? (3) what is stored in the argv array? What is in position argv[0] (4) The call to max_min is a pass by reference or a pass by value? Why? (5) At the top of the program the line: void max_min(char [], int, char *, char *); Is referred to as? What is its purpose? Why does it not have variable names? (6) what C header file is needed for toupper()? code: #include #include void max_min(int [], int, int *, int*); int main (int argc, char **argv) { intN; if (argc > 1)N = atoi(argv[1]);elseN = 10; // default caseif (N < 1 || argc > 2) { printf("Usage: %s [optional: #number of numbers for user to enter] ", argv[0]); return (-1); } int tempNum[N], big, small; printf("Enter %d number(s): ", N); int i;for (i = 0; i < N; i++) scanf(" %d",&tempNum[i]); max_min(tempNum, N, &big,&small); printf("Largest number : %d ", big); printf("Smallest number : %d ", small); return 0; } void max_min(int a[], int n, int *max, int *min) { * max = *min = a[0]; int i; for (i = 1; i < n; i++) { if (a[i] > *max)* max = a[i]; else if (a[i] < *min)* min = a[i]; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions