In the C programming language, you can't determine the array size from the parameter, so you have to pass it in as an extra parameter. The solution could be:
#include <stdio.h>
void swaparrayends(int arr[], int nrElements)
{
int temp = arr[0];
arr[0] = arr[nrElements - 1];
arr[nrElements - 1] = temp;
}
void main()
{
int i;
int myArray[] = { 1,2,3,4,5 };
int nrElements = sizeof(myArray) / sizeof(myArray[0]);
swaparrayends(myArray, nrElements);
for (i = 0; i < nrElements; i++)
{
printf("%d ", myArray[i]);
}
getchar();
}
In higher languages like C# it becomes much simpler:
static void Main(string[] args)
{
int[] myArray = {1, 2, 3, 4, 5};
swaparrayends(myArray);
foreach (var el in myArray)
{
Console.Write(el + " ");
}
Console.ReadLine();
}
static void swaparrayends(int[] arr)
{
int temp = arr[0];
arr[0] = arr.Last();
arr[arr.Length - 1] = temp;
}
The applications you have open, and some background processes.
Answer: 32 bit number
Explanation:
The IP address basically contain 32 bit number as due to the growth of the various internet application and depletion of the IPV4 address. The IP address basically provide two main function is that:
- The location addressing
- The network interface identification
The IP address are basically available in the human readable format. The IPV6 is the new version of the IP address and its uses 128 bits.
Option c is answer because most of us are literature in English
So here is the code in Python:
n = 0.00 #this is a float because there are some numbers that are decimals.
while n < 20: #n which is 0.00 and while it is lower than 20 if runs the code below
n = n + 1 #it will add 1 to n everything it runs the code.
k = n / 2 #it will divide whatever n is everytime by 2
print(str(n) + '/2: ') # it's printing the number it's on
print(k) # prints the answer for the n.
You can change n to add by any, make n any num instead of 0.00 and you can change the while condition from n < 20 to any other logical statement. If you want to get creative you can take 2 inputs for numbers and make one of them the starting number and other one is the ending number. Also make sure to make n a number lower than you starting point because if you set n as your starting point then it will skip it.