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 organizational structure described here, which is known as vertical organizational structure, is also commonly identified as tall organizations.
They usually have hierarchical structures, with the CEO being at the very top of the layer. Tall organization have multiple levels, compared to its counterpart, the flat organization or horizontal, which would only have one level.
Answer:
The programmer.
Explanation:
The CPU (central processing unit or simply the processor) is the brain of the computer system, it processes data at a very fast rate depending on it's processing speed. But it only relates to speed of data processing and a link between components of the system.
A software is a program code at executes a task in the system. It a logical and follows an algorithm to solve a given task. Computer systems do not generate lines of code by itself, but instead, A programmer writes the code to create the software used by the system.
Answer:
Zebra.
Explanation:
Stack is LIFO, so Zebra is added in the last so it will be removed first.