Questions tagged [logicaloperators]
The logicaloperators tag has no usage guidance.
6
questions
1
vote
1answer
30 views
Making code neater: a way to reduce repeated logical operators?
For CS50 pset1 Credit I'm using repeated logical-OR operators (||) to work out the validity and card brand of a credit card number. When I evaluate the style of my code using style50 it says to insert ...
0
votes
1answer
62 views
PSET4 Recover - Problem with my code
I'm Samuel and currently working on problem set 4 of CS50x recover. I have given it my best shot but came across an error:
error: using the result of an assignment as a condition without parentheses [...
0
votes
1answer
37 views
If condition with lots of conditions and logical operators. Getting a parenthesis error, need help
Edit: I had used $$ instead of && as an AND operator. The person below pointed that out to me. Removing the OG question because I had posted my code in it.
0
votes
1answer
41 views
What is causing this compiler error in my logical operators?
I have a question about logical operators. I've written some code for Pset3, Game-of-Fifteen, as part of the "MOVE" function. This code aims to determine whether "tile" is in a "legal" position to ...
0
votes
1answer
60 views
PSET4 Recover: parentheses and order of operation && ||
I was wondering if you could use parentheses to group logical and/or "&& ||".
I am writing up the part where I check if the file block is a jpeg and having saved the 512 byte array. I check:
...
0
votes
2answers
178 views
Pset 4 recover seg fault
/**
* recover.c
*
* Computer Science 50
* Problem Set 4
*
* Recovers JPEGs from a forensic image.
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
typedef ...