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

The problem set for Week 1 introduces the C programming language.

1 vote

Why won't the last line of my code print?

hint: what happens in the code when it reaches the lines of code that say return? hint2: what happens to new_pop, if new_pop is less than end_pop, and new_pop never changes?
MARS's user avatar
  • 5,179
1 vote
Accepted

make: Nothing to be done for 'Mario'

it seems that your "mario.c" is in the path: pset1/mario …
MARS's user avatar
  • 5,179
1 vote
Accepted

pset1 mario (less comfortable), expression error

you have an error in the following loop: for (d = 7-r; d >= 0; d-) I guess you want to write: for (d = 7-r; d >= 0; d--)
MARS's user avatar
  • 5,179
0 votes
Accepted

Error Code - Use of undeclared identifier in PSET 1, Mario

All errors are that you end each for loop with a semicolon, delete it. By the way the screenshots are not very useful, if it were necessary to reproduce your errors, no one is going to recopy your cod …
MARS's user avatar
  • 5,179
1 vote

pset1 less greedy - keep on getting errors

This is a scope problem, the variable "change" declared in main is visible in the whole main program, but when declaring change in the DO-WHILE loop, this second variable is different from the first c …
MARS's user avatar
  • 5,179
0 votes

My code does what I want it to do, but I get errors with check50 (PSET1, MARIO, LESS)

check50 is clearly telling you that you are printing an additional space on each line, that is because the for loop indexes that print the spaces are poorly adjusted, you have one more space it should …
MARS's user avatar
  • 5,179
1 vote
Accepted

CS50; PSet1; Don't know how to connect for loop with user's input + expected identifier or '...

Your loops are out of main and the function of your program, I guess what you want to do is #include <cs50.h> #include <stdio.h> int get_propriate_int(string prompt); int main(void) { int i = g …
MARS's user avatar
  • 5,179
0 votes

Pset1 cash.c Can't seem to wrap my head around it

for (int coins = 0; i < 0.25, coins++) Instead of a comma in the for loop we must put a semicolon. Regarding your error, it is a good warning from the compiler, the expression i <0.25 is never fulfi …
MARS's user avatar
  • 5,179
1 vote

incompatible pointer to integer conversion initializing 'int'

int n= get_int; I suppose you want: int n = get_int();
MARS's user avatar
  • 5,179
0 votes

pset1 credit working only in certain cases

The only reason for the behavior of the program that you describe is the function get_long_long, as it is implemented will only accept integers numbers, without any type of character. Are you entering …
MARS's user avatar
  • 5,179
3 votes
Accepted

Pset1: Problem: expected “##\n”, not “ ##\n”

Your own question hides the answer, carefully observe the difference: "##\n" " ##\n" There is a space that should not be there, the hashtag must be perfectly aligned to the left. Your program is …
MARS's user avatar
  • 5,179
0 votes

Problems w/compiling pset1

Your program compiles perfectly, what you show us in your question is not an error, they are all the options of the clang compiler that come by default with the command make, work that the course staf …
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
1 vote
Accepted

pset1 credit arrays

The strcat function will need two pointers, the name of the array is one the other we can obtain with the address operator & as indicated by your error: strcat(temp1, &cc_number[i]);
MARS's user avatar
  • 5,179

15 30 50 per page