Questions tagged [arrays]

The tag has no usage guidance.

8 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1 vote
1 answer

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, ...
Rachel Pospíšil's user avatar
0 votes
1 answer

Question CS50 2021 Caesar - where is the bug?

I'm currently struggling with a bug in caesar pset2. If i use check 50 everything is green except: :( encrypts "a" as "b" using 1 as key output not valid ASCII text :( ...
bloodycoder's user avatar
0 votes
1 answer

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 ...
paula.em.lafon's user avatar
0 votes
1 answer

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; ...
Mike S's user avatar
  • 1
0 votes
1 answer

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 ...
Peter Ryder's user avatar
0 votes
1 answer

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;...
Gateau's user avatar
  • 1
0 votes
0 answers

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 ...
Furrukh Jamal's user avatar
0 votes
1 answer

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 ...
ThisIsMe's user avatar