WAP mean Wireless Application Protocol or Wireless Access Point, depending on the context. WAP has no meaning with respect to arrays. I assume you are asking how to access a 2D array through pointers. The follow program shows one method of printing a 2D array of type int of any length:
#include<stdio.h>
// print 2D array of type int:
void print_array (int* arr, size_t rows, size_t cols) {
for (size_t elem=0; elem<rows*cols; ++elem) {
printf ("%d\t", arr[elem]);
if ((elem+1)%cols==0) printf ("\n");
}
}
int main (void) {
const size_t rows = 3;
const size_t cols = 4;
int x[rows][cols] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
print_array (&x[0][0], rows, cols);
return 0;
}
1d array contains single row and multiple columns and 2d array contains multiple row and multiple columns. 2d array is a collection of 1d array placed one below another,while 1d array is simple a collection of elements.
algorithm & flowchrt of 2d matrices
2D array of size 2x8 and 1D array of size 16
looda le lo mera
In GW-BASIC, a 2D array can be declared using the DIM statement, specifying the number of rows and columns. For example, DIM A(5, 5) creates a 2D array named A with 6 rows and 6 columns (indexing starts from 0). You can access and manipulate elements using syntax like A(row, column). Here's a simple example: A(1, 1) = 10 assigns the value 10 to the element in the second row and second column of the array.
if you were to call a function you would write it as: function(array[][], int pretend, double pretend2); arrays will always be passed by reference, not by value.
int main() { int array[3][3]; int i; for(i=0; i <9;i++) { printf("the element is %d\n", array[i/3][i%3]); } return 0; }
Pointers were always difficult subject to understand. I would suggest to read several tutorials and spend some time playing with them. Explanation: /* create array of two pointers to integer */ int *aaa[2]; /* setting first pointer in array to point to 0x1212 location in memory */ aaa[0] = (int *)0x1212; /* allocate memory for the second pointer and set value */ aaa[1] = malloc(sizeof(int)); *aaa[1] = 333; /* if you want to can make first item to point to the second, now arr[0] pointer address changed to the same as aaa[1] pointer */ aaa[0] = aaa[1]; /* print aaa[1] address and later print value */ printf("LOCATION: %X\n", (unsigned int)*(aaa + 1)); printf("VALUE: %d\n", **(aaa + 1)); /* exact the same here, but different way of how I wrote pointers */ printf("LOCATION: %X\n", (unsigned int)aaa[1]); printf("VALUE: %d\n", *aaa[1]); If you would do the same with 0 element of array, which points to 0x1212 memory location you would get some kind of number or Bus error if you accessed restricted memory place (for example the beginning of memory). I hope this I did not make you more confused than you are.
One efficient way to find the longest palindrome subsequence in Java is by using dynamic programming. This involves creating a 2D array to store the lengths of palindrome subsequences for different substrings of the input string. By iterating through the string and filling in the array based on the palindrome properties, you can determine the longest palindrome subsequence.
It requires the same amount of memory, so it wouldn't spare anything. Don't do it.
A pointer to pointer has many uses, one of the simplest being 2D arrays (matrices). Compacting garbage collectors also often employ pointer pointers.
To create an array of 18 pictures, you first need to load the images into your programming environment. For example, in Python, you can use libraries like NumPy or PIL to handle the images. You can then create a list or a NumPy array and append or reshape the images into that structure, ensuring that each picture is stored in a consistent format, such as a 2D array for grayscale images or a 3D array for RGB images. Finally, you can manipulate or display the array as needed.