Questions tagged [arrays]

The tag has no usage guidance.

7 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
1answer
28 views

Pset4 - Filter (more) Edge Detection Help

I'm testing my Gy function separately, and it looks like the values I put in the test array are not correctly showing up in the function. I printf() the main function and they are recording correctly, ...
0
votes
1answer
31 views

pset2 Readability: reading index being calculated incorrectly even though hard sentence, word and letter numbers are correct

The indexes come out sometimes too low,some times too high and I don't really understand why if the variable calculations come out right every time. Here's my code for it: //calculates average letters ...
0
votes
1answer
58 views

Runoff pset 3, arrrays and indexing

I don't understand what's going on with the solutions to the voter preference and tabulate functions. I had set up a similar function to the answer with the exception that I had [voter][i] = rank; ...
0
votes
1answer
63 views

PSET4 recover! dynamically allocated array does not seem to work

Hope all is well. This is probably a stupid question but I am going to ask it anyway. I have finally finished Recover (PSET4). I initially dynamically allocated an array as follows to store my 512 ...
0
votes
1answer
35 views

Having some issues understanding how pointers work and how to pass them to functions and use them

int* create_random_array(int n){ int arr[n]; srand(0); for (int i = 0; i < n; i++) { // Fill with random ints 1-100 arr[i] = (rand() % 100)+1; } return arr;...
0
votes
0answers
117 views

Why can't I create an array of strings?

I have this habit of first trying out all the exercises of the book then going on to psets. I am on chapter 7, arrays. the question was to make a program of some sort of voting counter and instead of ...
0
votes
1answer
14 views

Array initialilizer must be an intitializer list or string literal

Given this text: include include int main (void) { string text = get_string("Text: "); char num[] = text; } When this is run, it gives the error as stated in the heading of this question ...