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;
}
Encryption. Using a secret key, the data is encrypted. To decrypt it, the same or a different key is needed. Unauthorised entities should not have such a key.
The answer would be 798 since all of them combined with the square root dividing it would give you that.
Answer:
Digital logic circuits made of cascaded flip flops.
The different types of Bit Shift Registers are; Serial-In Serial-Out, Parallel-In Parallel-Out, Serial-In Parallel-Out, Parallel-In Serial-Out.
Shift registers can be used as converters to translate data, as delay circuits or counters.
Explanation:
Shift Registers are digital logic circuits made of cascaded flip flops. Their main function is to shift their contents (bits) to the right or to the left one bit at a time. Bit Shift Registers can process data either parallelly or serially. So the different types of Bit Shift Registers are;
- Serial-In Serial-Out
- Parallel-In Parallel-Out
- Serial-In Parallel-Out
- Parallel-In Serial-Out
Because of their ability to convert data from parallel to serial, shift registers can be used as converters to translate data. Some of their other applications are also delay circuits or counters, storing and manipulating data etc.
I hope this answer helps.