Skip to main content
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
Results tagged with
Search options answers only not deleted user 11300
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_
MARS's user avatar
  • 5,179
0 votes

while (n<1) ----- Why?

I don't think you have understood how a DO-WHILE loop works. The difference with other loops is that THIS is going to be executed at least once, regardless of the condition we impose. With this we get …
MARS's user avatar
  • 5,179
0 votes
Accepted

Is there an operator for raising in a power in C?

This is not to be taken literally, the circumflex accent notation ^ is a common way of representing power, and it is indeed a bitwise operator in C. …
MARS's user avatar
  • 5,179
1 vote

pset2 substitution

In effect it is not an ascii value for an alphabetical character, if, however, it is not what we are trying to do, but what we want is to substitute the m character for the corresponding one of the ke …
MARS's user avatar
  • 5,179
0 votes

PSET4 Recover - Can't Read Card

Problematic code, but we are on the right track, two things regarding your question: else { // NO // continue copying fwrite(buffer, 512, 1, output); } …
MARS's user avatar
  • 5,179
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 …
MARS's user avatar
  • 5,179
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 …
MARS's user avatar
  • 5,179
0 votes

I'm stuck on cs50 pset2 - crack

EDIT 2: You have an array of pointers, I would use char * dictionary = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; char key[12]; //to copy the characters To use a single character w …
MARS's user avatar
  • 5,179
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
MARS's user avatar
  • 5,179
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" …
MARS's user avatar
  • 5,179
0 votes
Accepted

CS50 Speller (hash table) - Check returning 0 misspelled words

return copyindex; The return statement has two important uses. First, the one that matters here, forces an immediate exit from the function in which it finds itself. That is, it causes the execution …
MARS's user avatar
  • 5,179
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 …
MARS's user avatar
  • 5,179
0 votes
Accepted

mario and problems with my array

I honestly do not understand what your question is, but the statement is incorrect: printf (" ",(num[i]+=1)); In printf, what goes after the quotes is variable that will be printed, with the approp …
MARS's user avatar
  • 5,179
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 …
MARS's user avatar
  • 5,179
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 …
MARS's user avatar
  • 5,179

15 30 50 per page