Questions tagged [practiceproblems]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
12 views

Encounter error, probably related to lack of understanding in the syntax of creating a function

In the prime exercise of practice problems 1 I am encountering the following error for the code below: non-void function does not return a value in all control paths [-Werror, Wreturn-type] #include &...
enzo's user avatar
  • 15
1 vote
1 answer
35 views

Practice Problem 4: error: incompatible pointer types passing 'char *[7]' to parameter of type 'char *' [-Werror,-Wincompatible-pointer-types]

#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { // Check for command line args if (argc != 2) { printf("Usage: ...
electrodarling's user avatar
0 votes
1 answer
75 views

I'm having trouble implementing loops to find prime numbers:

This is what I have so far, I've been at this for hours, re watched a bunch of stuff, I cant seem to get the hang of the loops, I've tried tracing what I think its doing, but I cant seem to work it ...
Yordaign's user avatar
0 votes
1 answer
894 views

CS50' Practice problem from the week first. Explanation for a newbie

// Calculate your half of a restaurant bill // Data types, operations, type casting, return value #include <cs50.h> #include <stdio.h> float half(float bill, float tax, int tip); int ...
REJEN RJ's user avatar
0 votes
1 answer
57 views

i keep seeing this line underlined with an error that says "using the result of an assignment as a condition without parentheses"

The program is not complete but here is the line causing me issues... string replace(string argv[1]); string output =""; for (int i = 0; output = strlen(argv[1]); i < output; i++)...
Gold Isaac's user avatar
1 vote
2 answers
1k views

Stuck on atoi Practice Problem, Week 3

I'm running into multiple problems when trying to do the atoi practice problem: My approach was to get the digit from the last position of the string, and add it to a variable "number"—...
Mailbox's user avatar
  • 111
0 votes
1 answer
585 views

I need help to fix my selection sort code - Practice Problems (Average High Temperatures)

I need help fixing my code. I don't know what else to do, I've been trying to sort all the temps array in descending order. But I don't know what I'm doing wrong. Can you help me saying what things I ...
AlvaroAndLukeTheCoder's user avatar