1. Write a function that converts a string into an int. Assume the int is betwee
ID: 3606427 • Letter: 1
Question
1. Write a function that converts a string into an int. Assume the int is between 10 and 99. Do not use the atoi() or the stoi() function.
2. Write a function prototype for problem 1.
3. Write a function call for the function you defined in problem 1.
4. Write a function that converts an int between 10 and 99 into a string.
5. Write a function prototype for problem 4.
6. Write a function call for function you defined in problem 4.
7. Declare a 2-dimensional array with 30 rows and 40 columns
8. Write a function that takes the 2-dimensional array argument from problem 7 and assigns the even rows random even numbers between 1 and 100 and assigns the odd rows random odd numbers between 1 and 100.
9. Write a function prototype for problem 8.
10. Write a function call for function you defined in problem 8.
11. What's the output from the following ...
Explanation / Answer
1) int convertToInteger(char str[]) { int i, n = 0; for (i = 0; str[i] != ''; i++) { n = n * 10 + str[i] - '0'; } return n; } (2) Function Prototype int convertToInteger(char *str); (3) Function Call char str[] = "12"; convertToInteger(str); 4) char *convertToString(int n) { char str[3]; int temp , i=1; while (n!=0){ temp = n%10; n = n/10; str[i] = temp; i = i-1; } str[2]= ''; return str; } (5) Function Prototype char *convertToString(int n); (6) Function Call int n = 12; convertToString(n); (7) int arr[30][40]; (8)void fun(int arr[30][40]){ int r ; for(int i = 0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.