Skip to main content

All Questions

1 vote
1 answer
44 views

3D array manipulation from within a function

So, I am trying to create a mini chess simulator for a project. In the project, I decided to use a 3D array to represent the chess board, with the dimensions representing X, Y, and Piece Data. My ...
ShieldCat's user avatar
  • 113
3 votes
1 answer
98 views

Is it possible to initialize a 2D array by calling two functions? example: array[starting_rows()][starting_columns()]

I'm in the process of programming the game 4-in-a-row in C language, the user is supposed to enter the size of the board, the maximum 2D array (board) that I'm allowed to accept is 25X25. In short, ...
Razi Al Ashhab's user avatar
-4 votes
1 answer
46 views

How do I transform certain array elements into sub-arrays using JavaScript? [closed]

From this javascript array var test = [0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1]; How can I do to get the result as displayed below. Thank you. test = [[0],1,[0],1,1,1,[0,0],1,[0,0,0,0],1]; I have ...
Gerardo Scoppetta's user avatar
0 votes
2 answers
82 views

Modifying Arrays Between Files and Functions in C

I am trying to build a Sudoku Solver. I am also trying to create small files for each task so that I don't have an impossibly large file to debug. Ignoring the input, I need to take the 9x9 matrix and ...
Hayato's user avatar
  • 43
2 votes
3 answers
273 views

Difference between int* a and int (*a)[N] in functions?

I can pass int arrays to both of these functions (1d and 2d arrays). What is the difference between them? With the second function you need to specify the size of the array. Why? void foo(int *a, int ...
adsf's user avatar
  • 59
0 votes
0 answers
153 views

How to pass a variable number of arguments (lists) to a function to create an array out of these?

For example, I have the following function: import numpy as np def CreateBoxes(x_1: list, x_2: list): boxes = np.array([[y , z] for y in x_1 for z in x_2]) return boxes Which may return ...
Michel's user avatar
  • 3
0 votes
1 answer
70 views

[ C# ][ Errors: CS0443, CS0120, CS1503 ] Can't pass a bidimensional array to a function

Hello I'm trying to pass an array to a function. First I was trying to pass it by value but apparently it has to be done by reference so I added a "ref". This gives me a "CS0443: A ...
TryingToLearn's user avatar
1 vote
1 answer
108 views

Trying to find the most popular element of array

This is my last try. I tried to find the most popular element in a string, for do this i've taken the string and converted single character in number and after this i sorted them in int array. the ...
steno's user avatar
  • 7
1 vote
2 answers
424 views

How do you pass a user defined array through a function?

I want to ask the user for the size of a 2D array arr[][], but also pass it through the function initializeArray. However, if I pass it through the function, I would have to have a size declarator for ...
Mysterai's user avatar
-1 votes
1 answer
34 views

2d array with function javascript

I've task to create function that will display names from 2d array (const users). Each name should be displayed in separate line in console. Here is the code I've prepared but not sure if it's correct?...
Stacey's user avatar
  • 9
0 votes
1 answer
30 views

2d arrays issue connected with passing a filled array

I'm working with c++ arrays and I found a problem. I can easily do the exercise using cin and filling array with for loop. But when I try to do it as filled array I got the error with too many ...
Michau123's user avatar
0 votes
4 answers
154 views

Probleme with empty items in 2d array

I'm trying to build 2d array with JS. In a theater there is 26 lines, each one include 100 seats : function theaterSeats() { let seats= new Array(26); for (let i = 1; i <= 26; i++){ seats[i]...
GrischK's user avatar
  • 31
0 votes
1 answer
184 views

Print each row twice in a 2D array - C

Good day! How do I print each row twice in a 2D array in C program? for(int row = 0; row < 5; row++) { for(int col = 0; col < 5; col++) { printf("%d ", arr[row][col]); ...
OverHeaven's user avatar
1 vote
1 answer
609 views

How can I make a JavaScript function that takes two arguments (numRows, numColumns), and returns a 2D array with the correct grid values?

Write a function makeGrid that accepts two arguments: numColumns (number) - how many columns we want our grid to have numRows (number) - how many rows we want our grid to have makeGrid should return a ...
Joseph Corrado's user avatar
-1 votes
1 answer
63 views

What is the syntax for passing 2d arrays through functions?

I want to write a function that finds the sum of the values of a column in a 2D array. The function prototype is: int columnSum(int array[][NUM_COLS], int numRows, int target) Where NUM_COLS and ...
Mysterai's user avatar

15 30 50 per page
1
2 3 4 5
16