Question: Please explain the codes from 173 to 179. Its pointer lab in C * * * 167 159 * Given pointers to two distinct variables
Please explain the codes from 173 to 179. Its pointer lab in C
* * * 167 159 * Given pointers to two distinct variables write a function to swap the values 160 * of said variables. 161 * 162 * ALLOWED: 163 Pointer operators: *, & 164 Binary integer operators: -, +, * 165 Unary integer operators: ! 166 Shorthand operators based on the above: ex. +=, *=, ++, --, etc. * 168 * DISALLOWED: 169 * Pointer operators: [] (Array Indexing Operator) 170 Binary integer operators: &, &&, lill, , >, ==, !=;^, /, % 171 * Unary integer operators: ~, 172 */ 173 void swapInts(int * ptri, int * ptr2) { 174 // Your code here 175 176 int temp; 177 temp = * ptr1; 178 * ptr1 = * ptr2; 179 * ptr2 = temp; 180 } 181
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
