Featured Post

ARM- ADC and LCD Interface

In real world all natural quantities like temperature, pressure, light intensity etc. are analog. If we have to deal with such quantities us...

WAP to reverse the contents of an array of n elements

Here we first took the size of array from user as an input 'n', then we we dynamically create memory for those n elements using the malloc function as shown in figure. Next we took the input for elements of array from the user using the for loop, further, we've used two for loop in line 14 and 16 to access i and i+1 element in the array, next in lines from 20 to 22 swapping mechanism has come into play by creating a temp variable.

If you don't understand the swapping technique click here: swapping mechanism to sort array.

Then we print the array, as shown in the line 27 of the code.





No comments:

Post a Comment