Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
3
votes
PSET4, Recover - Generated JPGs are blank
I think you complicate your program unnecessarily with calls to functions that do not clarify the code, recover can be done in a simpler way, and personally I always look for the greatest possible sim …
2
votes
Accepted
Why is my get_positive_int code not working? (I seem to do everything right!)
you have a small typo error in the function you have written:
int get_positive_int
versus:
int get_positive_int_
1
vote
what is wrong with scanf in the program written bellow, Why it is not asking for value when ...
Let us begin:
scanf requires you to specify the type of data you'll typed in, according to your program is an integer
int c=scanf("%d",&minutes);
I think what you intend is that if c is a character the …
1
vote
CS50 Format Specifiers in c
I assume you're referring to the format specifiers of printf function, these are the same as those of the standard version of C, but if you're mean the cs50.c library uses its own data types in order to …
1
vote
PSET 6 Parse Function:
three problems:
char* buffer = malloc(sizeof(line));
It is quite probable that we are not reserving enough memory, better to do:
char* buffer = malloc(strlen(line) + 1);
the use of strtok is inc …
1
vote
Accepted
Vigenere:non-alphabetical character
i<= strlen(keyword)
keep in mind that keyword begins with the zero subscript so that if its length is given by strlen the one index is strlen(keyword) - 1, the correct statement would be:
i < strle …
1
vote
Accepted
'int' but the argument has type 'int * problem with sort in helpers.c
The array name "values" is a pointer, it does not serve us %i, to show the complete array it is necessary to use a for loop:
for( int j = 0; j < n; j++)
{
printf("%i", values[j]);
}
A void func …
1
vote
Pset1, Cash problem
Just a couple of things, you are assigning an operation between variables of type float to a variable of type int. When this is done the result is truncated, it is not rounded, hence the results you g …
1
vote
Accepted
PSET1 / Credit / Modulo problem / Error: invalid operands to binary expression ('double' and...
the definition of the pow function says that it returns a double that is the reason of your error, since the operator modulo requires integers, it is possible that it works if we do a casting although …
1
vote
pset1 Error: indirection requires pointer operand
What is supposed to be * card? We can not apply own operators of a pointer to a variable of integer type in this case. It seems that the compiler is interpreting this as an indirect operation of a poi …
1
vote
Receiving 'error: expected expression' for code inside if statement (pset1)
To evaluate the right side first we must put the parentheses on the right side of the identity, not the operator == itself
if (counterCardLength == 15 && FindFirstTwoDigits == (34 | 37))
if (a == (1 …
1
vote
pset 2 caesar help!
encrypted character, the following works:
if (alphabets_upper[index] == s[i])
{
int cipher = alphabets_upper[(index + key) % 26];
printf("%c" … , cipher);
}
if (alphabets_lower[index] == s[i])
{
int cipher = alphabets_lower[(index + key) % 26];
printf("%c" …
1
vote
Got into an unexpected error while compiling the code
If you use the IDE, the easiest way is to use the make command, if not, you must use the -lcs50 option when compiling to avoid the error indicated
1
vote
Accepted
speller (hash) - check50 showing "handles substrings properly"
You have a "small" problem in check function, you actually go through the entire hash table without finding any match. What happens if strcasecmp () is zero? Why do you keep moving forward in the hash …
1
vote
Accepted
too few arguments to function call, at least argument 'format' must be specified
In the current implementation of the functions of the header file cs50.h, we need at least one argument of the type char *, that is, a string, something similar to the function printf (), therefore to …