Question: In C arrays can be accessed using pointers. As an exercise, write a function that reverses the polarity of every element in a 2 D
In C arrays can be accessed using pointers. As an exercise, write a function that reverses the polarity of every element in a D int array ie becomes becomes etc. using only pointers. That is your code must not use any which is the nonpointer version of array access. Use this function header:
void reversePolarityunsigned int row, unsigned int col, int array
For example, suppose we have a by array myDIntArray with the content Then the function will be called as the array needs to be created differently, see the test file:
reversePolarity myDIntArray
And when the function returns, the content of myDIntArray becomes
You can assume that the row & col parameters always correctly indicate the number of rows & columns of the array. Do not use anywhere in your answer if you do you get for this question
Only include the aquestionh header file and the function definition and your helper functions, if any in the source file and name it as aquestionc
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
