Answered step by step
Verified Expert Solution
Question
1 Approved Answer
USING C AND COMMENTS! Print Matrix Trying to have a 2D array parameter in a function in C isn't as simple as in Java. Like
USING C AND COMMENTS!
Print Matrix Trying to have a 2D array parameter in a function in C isn't as simple as in Java. Like with single dimensional arrays, it's common to actually make the parameter a pointer to a pointer type rather than an actual array type. Create a function to print a 2D array of characters. Write a program that asks the user for a height and width and dynamically allocates a 2D array of those dimensions. Fill the array with dots and then randomly put asterisks in some elements. For the number of asterisks, it should be 10% of the width times the height cast to an int (for example, 10 * 10 * 0.1 = 10). Then, use the print function on the array. Here's the function header to get you startec: void print_matrix (char matrix, int height, int width) Sample Run Enter Height: 10 Enter Width: 10 Asterisk Count: 10 array (0x7f939d600000) icStep 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