All Questions
31
questions
-3
votes
1
answer
45
views
What is wrong in my code of 2d array by taking input from user using c [duplicate]
#include<stdio.h>
int main()
{
int i,j,m,n;
int a[m][n];
printf("enter the row of matrix:");
scanf("%d", &m);
printf("enter the column of ...
0
votes
1
answer
61
views
What is the best practise when working with 2D arrays in C, if it exists?
Question: What is the best practise when working with 2D arrays in C, if it exists?
As far as I program in C I always get my mind confused whenever using 2D arrays would be convenient.
I like ...
-1
votes
2
answers
33
views
Why won't the average column amount not calculate?
I want to print out the average amount of an 2D array column, by filling the matrix with random numbers
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int m = 0;
int ...
0
votes
2
answers
960
views
C, 2D Array, How to find specific number in all 8 directions
You are allowed to enter only 0 and 1 as values in the arrays. Then in place of all elements having a value of 0, enter the number of elements with a value of 1 around that element in all eight ...
0
votes
1
answer
265
views
How do I put a 2d array of chars into a 2d grid array cells
I'm trying to make a 2048 game right now but I'm having trouble putting my 2d character array into the 2d grid array cells that I made. I'm a beginner programmer learning the basics of C. Here is the ...
0
votes
3
answers
354
views
C language how to remove or not show rows with 0 value column
for example, we have this
0 1 0 1
0 3 1 0
0 1 5 0
0 0 0 0
matrix I want to show just rows and columns with non zero elements
the final matrix view should be this
1 0 1
3 1 0
1 5 0
how can I remove ...
0
votes
1
answer
37
views
Return 2d array and pass it as argument to another function
I'm new to C, I would like to ask a question about the use of functions in C.
I need to create two functions, the first one to create a 2D array and the second to print it.
I use a file called ...
0
votes
1
answer
73
views
Read a file character by character and pass them to an array in C
I have to parse a matrix from a file which first line characters are the rows and the cols count and the next lines are the matrix values.
The file contains:
3 3
R R B
B G G
G B R
I wrote the ...
2
votes
1
answer
52
views
C 2D Arrays removing certain predetermined rows by shifting the ones below it
This is my first post here.
An assignment of my online course in C asked me to remove each row in a real(non dynamically allocated, pointers are not used) whose average sum is greater than the ...
0
votes
0
answers
32
views
Removing a column of a 2D Array in C by overwriting its elements
I need help with understanding the mechanism of removing a column of a matrix. Say, if I had a matrix which looks as follows:
1 2 3
1 2 3
1 2 3
I'd want to remove the second column so the whole ...
0
votes
1
answer
1k
views
Going through 2D matrix Bubble-Sort C
So, that's the sorting of 2D matrix like a snake.
Here's my code but there are a few problems.
Sorting doesn't go as I wanted. It has inifinite cycles almost in every size of matrix. I don't ...
1
vote
2
answers
71
views
Searching for efficient clustering algorithm
In a 2D NxN matrix each point represents a area of a map. There are M numbers of customers in random areas whose service need to be served by K numbers of customer service centers in random areas. ...
0
votes
1
answer
2k
views
Static Matrix multiplication to dynamic matrix in c
I need to build program that make Matrix multiplication.
When i have 2 Static matrix, and the function return pointer to the new dynamic matrix.
My problem is make the multiplication right when I'm ...
0
votes
1
answer
244
views
Dfs using linked list in 2d matrix - C [closed]
I got for my school project a task that I dont know how to solve and I'm stuck. I have to run over this labyrinth:
#T###########
#.#...R.....#
#.###.#.###.#
#...Q.#...#.#
#.#####C#...
0
votes
0
answers
62
views
(C) How to fill a 2D array with an input that's a full N x N matrix?
I'm trying to make a 2D array of size N x N that is going to be filled with a matrix input.
printf("Enter the %d x %d matrix: \n", length, length);
for (m = 0; m < length; m++) {
for (n = 0; ...