Questions tagged [multi-dimensional-arrays]

Filter by
Sorted by
Tagged with
0
votes
1answer
50 views

Pset 3 runoff. Votes not updating, trying to understand the code sequencing

Ok so im stuck on the tabulate funtion in runoff for pset3. The issue im having is that when i call to "printf" the candidates vote counts the votes still come out as 0. So i dont think the ...
0
votes
1answer
12 views

What is the explaination of the declaration of image array in filter

I was looking through the filter.c file in the pset4-filter-less and I want to understand the theory behind the declaration of array as shown below: RGBTRIPLE(*image)[width] = calloc(height, width * ...
0
votes
1answer
217 views

pset3 Tideman: function to print out preferences array is not working

I have written a function, print2d(), to print out a 2D array. I am using it to print out the preferences array after calling record_preferences() in main according to the provided template. The ...
0
votes
1answer
50 views

Game of Fifteen - Move Function - getting wrong coordinates?

I have been working on the game of fifteen problem and seem to be having an issue. I keep getting an "Illegal Move" when it is a legal move. I think I have found part of the issue and I would just ...
0
votes
1answer
58 views

handlign multidimesional arrays as function arguments and return values

So I stuck at the pset3, at the place where you need to implement game of fifteen. How can I pass multidimensional array as an function argument? And how can I return multdimesional array as a ...
1
vote
1answer
84 views

pset3 move() makes every tile swapped a blank tile

I rewrote almost the entire code and I finally was able to make the tiles swap. Problem is at every swap the blank tile gets duplicated and the tile swapped disappears, eventually rendering a Segfault....
0
votes
1answer
42 views

2D array of given size

I want to create a 2D array of ints, where the array's dimension is given at run time (not compile time). So far, I have been using: int **ptr = malloc(m * sizeof(int*)); for (size_t i = 0; i < m;...
0
votes
2answers
196 views

understanding 3D arrays

#include <stdio.h> int main() { int a [2][3][2]={ { {1,2},{3,4},{5,6} }, { {5,8},{9,10},{11,12} } }; printf("%d\n%d\n%d\n", ...