1
vote
4answers
53 views

Manipulate multidimensional array in a function

I read a lot of stuff in here and tried many but i couldn't find a way to pass a multidimensional array to a function in C,change some of the values and somehow return the new array. It's important to ...
1
vote
1answer
77 views

C - passing array to node of a linked list

I have a 2D array already filled with integers, ready to be cut to rows and processed, and I need each row (1D array) to be passed to a node of a linked list. Each node looks like this: struct node { ...
13
votes
4answers
169 views

Peak element in an array in c

I am given an array of integers. I have to find a peak element in it. An array element is peak if it is NOT smaller than its neighbors. For corner elements,consider only one neighbor. For example: ...
0
votes
4answers
74 views

Dereferencing array pointer in a function

How do you deference a pointer to an array to get the value stored in it? For example: void testFunction(int **test){ printf("%d", *test[1]); } int main() { int test[10]; test[1] = 5; ...
1
vote
0answers
68 views

Difference between double** and &arr, where arr is a double[] [duplicate]

I am using C. I have a double array like this: double arr[3]={1,2,3}; Next, I assumed that a double[] is just like double *, and thus I created this pointer variable: double ** ppdArr = ...
2
votes
3answers
60 views

C - Array of strings (2D array) and memory allocation gets me unwanted characters

I have a tiny problem with my assignment. The whole program is about tree data structures but I do not have problems with that. My problem is about some basic stuff: reading strings from user input ...
0
votes
3answers
82 views

Analyze memory usage of a C program

I know there are a lot of similar questions(i am not sure for a possible duplicate) but my question is specific enough.I am running a C program in Windows and Unix and i am experiencing a segmentation ...
2
votes
2answers
71 views

difference between int *a[3] and int (*a)[3]? [duplicate]

I want to know what is a difference between : int *a[3]; And int (*a)[3]; Thanks a lot , good luck .
0
votes
1answer
53 views

How to determine height and length of a 2D array from stdin?

My program has to read contents of a file like so: name_of_program < Test.txt Test.txt is a 2D array of integers (integers are separated by spaces, sometimes multiple ones, rows of integers are ...
-4
votes
0answers
33 views

Pointer to arrays of characters [closed]

I tried to create pointer to arrays of characters but there is an error. I used next line for allocation: char* array[3]; The only idea that i have is that the arrays are allocated statically and I ...
-3
votes
3answers
70 views

Pointers with Character array in C [closed]

What would be the output of the following program? main( ) { char s[ ] = "Get organised! learn C!!" ; printf ( "\n%s", &s[2] ) ; printf ( "\n%s", s ) ; printf ( "\n%s", &s ) ; ...
0
votes
1answer
33 views

Are my solutions to printing an error due to file size and storing values right?

PART 1: What I need to do is print out an error if the file size exceeds the 500 by 500 measurements (defined at the top as max_width and height). I PART 2: The other part is that I have to read the ...
1
vote
5answers
101 views

Iterating An Array Symmetrically

Wasn't exactly sure how to title this, but I hope it makes sense. I want to iterate an array forwards and then backwards, x number of times. One option is to double the size of the array and then ...
1
vote
3answers
71 views

how to memcpy the two dimensional array in C?

How to memcpy the two dimensional array in C: I have a two dimensional array: int a[100][100]; int c[10][10]; I want to use memcpy to copy the all the values in array c to array a, how to do this ...
-1
votes
1answer
131 views

Why Array index start from '0' [duplicate]

I have a question on C/C++ arrays. Why does the index of the arrays start from '0' not from '1'? Is there any mathematical reason for that?

1 2 3 4 5 263
15 30 50 per page