21 questions
2
votes
2
answers
80
views
Pulling values out of one multidimensional array and putting them into several 1D arrays (C)
I am trying to sort the values in the Data array into Column arrays X1,X2, and Y_actual. The code I have written out makes sense to me, and returns the correct array1,array2, and array3 values if I ...
-1
votes
1
answer
100
views
What is the actual practical difference between int x[] and int *x[] in C?
Although I've learned and worked with many advanced languages, but today when I was refreshing my C skills this old question again striked me. When we talk about pointers in C, simple pointers are ...
2
votes
0
answers
121
views
Why does a php array in two foreach loops lead to an infinite loop?
I have this PHP code:
$array = [1, 2, 3];
$counter = 0;
foreach($array as &$elem){
test();
$counter++;
if($counter >= 10){
return;
}
}
function test(){
global $...
0
votes
0
answers
50
views
Accessing specific objects using pointer to multiple arrays of pointers
EDIT: Pasting portion of code that is giving me this issue. Although in my effort to cleanup some of the comments before pasting it here I ended up with a different error. Still happens in the same ...
0
votes
2
answers
213
views
Pointer-to-array, malloc, and out-of-bounds access
Given a pointer-to-array in C, can we malloc to it enough memory for extra elements (beyond the specified array size) and then safely access those elements using either the [] operator or pointer ...
1
vote
0
answers
45
views
What is the difference between these two methods of dynamic allocation of arrays?
I was going through array using pointers and I found two different dynamic allocation methods of an array
int *ptr_arr=new int[10];
This one was defined in the lectures but when I explored a bit I ...
1
vote
1
answer
218
views
What is the implicit decay of char* arrays?
As a newbie, I'm solving a problem from K&R's pointers chapter and was confused with some aspects of character pointers, and passing an array of type char* as a function parameter.
Char array ...
0
votes
1
answer
69
views
confilicting types in C
i have this main and 2 more functions each on different file
/*decleration of the functions on one file*/
typedef double *mat[4][4];
void catcher(void *,mat *);
void findMat(mat *,char *,int *);
int ...
1
vote
1
answer
60
views
Seg Fault calling mergesort on pointer array
I am trying to work with threads in C. I need one of my threads to work on one half of a whole array, and mergesort its half. To do this I created a global array pointer for the whole array and both ...
0
votes
1
answer
68
views
Value of array pointer is getting changed after fopen
I am doing convolution operation for image. I have a problem in data stored in array pointer dynamically. The data in one of the array pointer variable is getting changed automatically after fopen ...
1
vote
3
answers
100
views
Understanding and manipulating pointers to integer arrays
I am having troubles with the following code:
int a[] = {1, 2, 3, 4};
fprintf(stdout,
"a : %lu\n"
"*a : %d\n"
"&a : %ld\n"
...