All Questions
Tagged with multidimensional-array multidimensional-array
36,166 questions
1
vote
2
answers
58
views
XML with attributes to array in PHP
I am trying to convert an XML string into multi-dimensioned PHP array. The difficulties are that XML comes with attributes and has nested values. My code works at parent level data but I am not sure ...
2
votes
3
answers
157
views
Is there a performance drawback when declaring 2D arrays using int** compared to int (*)[N] in C?
I have a question about the performance tradeoffs between different ways of storing 2D arrays in memory in C.
I know that if I declare a 2D matrix A with dimensions MxN by the following:
int (*A)[N] = ...
0
votes
0
answers
70
views
I am confused by mdspans' "layout policy", "layout mapping" and "layout mapping policy"
I'm looking at the newly-introduced std::mdspan class template (also described here on SO). One of the template parameters is, according to cppreference:
LayoutPolicy - specifies how to convert ...
-4
votes
2
answers
107
views
Replace hard coded values in nested array with variables in PHP [closed]
I have some sample JSON from an API provider and am struggling with how to replace the hard coded values with a variable using PHP.
I have tried json_encoding the JSON string and changing the ...
0
votes
1
answer
72
views
how to create uniform nested lists and convert them in to multi dimensional arrays?
i would like to create a nested list of arbitrary depth (containing numerical values specifically) with uniform arbitrary lengths at each level and then compress it to a NumPy array of minimum ...
1
vote
2
answers
67
views
Vector from Class objects vector as 2D vector function parameter
Solution requirements:
Pre C++11
Statements:
Function someFunction exists, that accepts 2D vector as vector of string vectors: vector2d.
Class someClass exists, that contains 1D vector of strings: ...
-3
votes
1
answer
137
views
How does C know that you're out of bounds in a multi dimensional array? [duplicate]
I'm trying to learn C coming from Python. I was curious on how a multi dimensional array looks like under the hood in C. It turns out, its just a chunk of memory.
For say, a 3x3
0x1000
0x1004
0x1008
...
1
vote
1
answer
69
views
Declaring multidimensional arrays in C [duplicate]
#include <stdio.h>
int main() {
int arr[2][3] = {1,2,3,4,5};
printf("%d", (*arr)[4]);
return 0;
}
See the array declaration in the above code. As per my knowledge, this ...
0
votes
1
answer
56
views
Facing issue while with Parse JSON having nested array in TIBCO BW6
In TIBCO BW6, I am trying to parse below JSON having nested array with below XSD.
But getting error : TIBCO-BW-PALETTE-REST-100016: An error occurred while converting json to xml: Content of array ...
0
votes
1
answer
106
views
How to convert a 1 dimensional array buffer to a 2 dimensonal format
I have this intermediary buffer that has the entire contents of a file: char *intermediary_buffer
I need to move this to a different 2D buffer: char **final_buffer Where a new row is started every ...
2
votes
2
answers
113
views
How to print one string in a 2D character array?
I am using Code::Blocks 20.03. I have been trying to print a string from a 2D char array but only receive random characters.
int main() {
char str[5][80];
str[1][80] = "hello world";
...
2
votes
1
answer
110
views
Idiom for owning multi-dimensional arrays, after mdspan standardization?
The C++ standard library, and specifically its part involving containers and ranges, is mostly "one-dimensionally oriented" - things have a start and and end you go from start to end. If you ...
2
votes
1
answer
77
views
Rotation of square Matrix not working correctly after first rotation
Please check the below code, the mat array after the second rotation should be identical to the target array tar. However, it is not happening. Could you please review to check where the logic is ...
1
vote
3
answers
114
views
Recursively convert multidimensional array data into new multidimensional variables with hierarchical metadata included
I have an array of some parameters (like a YAML config file) and this need to be written to database finaly with primary ids and so on.
For example this is a part of my array:
$settings = [
'basic'...
-2
votes
1
answer
74
views
Copy a multidimensional array and replace one certain key in the duplicate
We have a large web app with a lot of files where english language strings are in a file.
Consider this file: sample.php
<?php
$newFlowString['english']['login'] = "login";
$...