Skip to main content

Questions tagged [syntax]

The tag has no usage guidance.

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

Pset4 filter-less -- "function definition is not allowed here"

I've been pulling my hair out trying to figure this out. For some reason the compiler is convinced that I have a function definition that is "not allowed" in my code but I have no idea why ...
Fitzpatrick0909's user avatar
0 votes
2 answers
18 views

Why is my code not compiling (simple get_int example)?

I just started this course. I think I am copying exact code from David and in his screen it works but not in mine. What's the issue?. actual code: #include<cs50.h> #include<stdio.h> int ...
DevloperOso's user avatar
0 votes
2 answers
62 views

Stuck on Lab 1 #CS50

I'd appreciate your help as I'm stuck on the last part of Lab 1. #include <cs50.h> #include <stdio.h> int main(void) { // TODO: Prompt for start size int start; do { ...
Kareem's user avatar
  • 1
0 votes
2 answers
53 views

Could someone explain to me how curly braces work?

#include <cs50.h> int main (void) { int height; do { height = get_int ("Enter Height"); } while(...
Anastasia Toska's user avatar
0 votes
1 answer
127 views

Syntax Highlighting Error

I am working on my mario problem. I write my code in C, but it's not getting highlighted, meaning the program doesn't understand it. How can I get it to understand my code? for example #include is in ...
Tisha Rajput's user avatar
6 votes
2 answers
2k views

Understanding how memory is allocated in driver code PSET 4, Filter (Less Comfortable)?

What does the following line do, step by step (filter.c L:78) RGBTRIPLE(*image)[width] = calloc(height, width * sizeof(RGBTRIPLE)); I am most confused by the syntax of RGBTRIPLE(*image)[width] ...
drl's user avatar
  • 81
0 votes
1 answer
273 views

Why can't I print the entire string from the read file?

For the DNA assignment in pset6, I'm trying to print out the output of slicing the string that was read from one of the DNA sequence text files, which reads as follows: ...
Daniel Hering's user avatar
1 vote
1 answer
505 views

cs50 pset7 buy syntax error

i cannot see any syntax error for several days, so if anything can help is highly appropriated here is my code : @app.route("/buy", methods=["GET", "POST"]) @login_required def buy(): """Buy ...
Yao Lu's user avatar
  • 15
0 votes
1 answer
131 views

What is correct syntax when declaring a pointer? (i.e. where to place the *?)

I'm a bit confused as to where to place the * when declaring a new pointer. For example, let's say I've made a linked list and declared a custom structure node. I've noticed when I was making ...
doctopus's user avatar
  • 119
0 votes
1 answer
157 views

Problem with && and || operators in credit

Forgive me for the confusing syntax, I am new to coding. My question is simple. In my last statement, >> "else if (digits[15] == 5 (&&) digits[14] == 1 || digits[14] == 2 || digits[14] == 3 || ...
David's user avatar
  • 11
0 votes
1 answer
2k views

Mario Less Comfortable, do-while loop problem

Hi everyone I made sure to do my research and go through the already posted questions. I am certain my while condition is wrong after research but don't understand the correction. my program runs but ...
TheWardedCoder's user avatar
0 votes
0 answers
30 views

ps3 fifteen move and won : error : control may reach end of non-void function [-Werror,-Wreturn-type] }

Im so close to finish fifteen. I have a mistake about syntax with the last } for my function Move() and Won(). Here the error message when I compile : fifteen.c:279:1: error: control may reach end of ...
Genevie's user avatar
  • 30
0 votes
1 answer
313 views

PSET 6: Caesar.py - stuck on "SyntaxError: invalid syntax"

For my caesar implementation in Python, the CS50 IDE keeps telling me that I have a syntax error at the else portion of my for loop as shown below. Any help would be GREATLY appreciated! Haha, thanks ...
beiyingseah's user avatar
0 votes
1 answer
22 views

Why do header files have different symbols in C?

why do we use different syntax for header files in C. I mean, why stdio.h uses greater than and less than symbols < > while bmp.h uses quotation marks " "? #include <stdio.h> #include <...
gonzaloorsi's user avatar
0 votes
3 answers
4k views

python invalid syntax end=""

The first print line I use , end="" in has a red dot next to it and is marked as invalid syntax. The python code still works with no problems but the invalid syntax is always there. I even copied ...
Adam's user avatar
  • 41
3 votes
3 answers
12k views

MARIO LESS COMFORTABLE

I have been working at this pset for hours. within 5 minutes i got the hello.c and water.c assignments completed. But when it comes to mario.c, I am utterly lost. I have watched every video. I ...
Austin Tyler Cunningham's user avatar
1 vote
1 answer
74 views

The syntax "<%- place_name %>" in pset8

To me, it just magically insert the variable into the string for suggestion. I wonder what kind of the syntax is this, any reference? Thanks.
Wayne Lin's user avatar
0 votes
1 answer
10 views

What's is wrong with this php code

The interpreter won't interpret my code for some syntax error in line 13 and I can't figure out what's the problem. <?php extract($_GET) for($i = 0; $i < key; $i++) ...
A.Emad's user avatar
  • 176
0 votes
1 answer
99 views

caesar store ascii value as int, in loop

I have tried using single quotes notation to store the ascii value of a char in an int, but only as a hard coded character. I can't get it to work as it loops through the chars in the string. I tried ...
Avishai Fuss 's user avatar
0 votes
1 answer
167 views

What does VALUES(shares) refer to in the ON DUPLICATE KEY UPDATE clause?

This is the working snippet: query("INSERT INTO portfolio (id, symbol, shares) VALUES(?, ?, ?) ON DUPLICATE KEY UPDATE shares = shares + VALUES(shares)", $_SESSION['id'], $_POST["...
Lex's user avatar
  • 55
0 votes
2 answers
413 views

How come you can declare variables in C in the middle of a block?

In Week 1 of CS50, I saw that David sir was declaring variables in the middle of the block...Isn't this a violation of the standard C syntax ? Aren't we supposed to declare the variable at the start ...
Gautam Sharma's user avatar
0 votes
1 answer
71 views

php syntax questions

I am having trouble with formatting php correctly. Specifically, when I need to use two sets of double quotes, how do I make it group them correctly? eg: query("INSERT INTO Holdings (id, symbol, ...
Susan's user avatar
  • 13