3
votes
Accepted
week3 lecture very beginning
If I understand your question correctly, and it's "what is the role of argc" the answer is that we need it to know how many arguments were passed to main from the command line. So if the command was ./...
2
votes
Accepted
vigenere ,, segmentation fault core dumped
Your problem is isalpha(argv[1]) isalpha takes a single character as input. argv[1] is a string of multiple characters, not a character. You cannot apply isalpha to an entire string. It causes a seg ...
1
vote
Accepted
PSET 3 runoff is_tie function
According to the spec:
The function should return true if every candidate remaining in the election has the same number of votes, and should return false otherwise.
I interpret the name of the ...
1
vote
Find.c - Binary Search probable integer overflow
Your values are like
+---+---+---+---+
|min|max|mid|<>=|
+---+---+---+---+
| 0|999|499| < |
| 0|498|249| < |
| 0|248|124| < |
| 0|123| 61| < |
| 0| 60| 30| < |
| 0| 29| 14| ...
1
vote
Accepted
Week 3 Binary Search Video Short question
in case we have a single element left in the array, max and min would be equal. the midpoint is calculated, and we check whether array[midpoint] is equal to the value we're looking for.
if the ...
1
vote
Accepted
Initials ,, The Right output but not accepted
You also need to print a new line \n after the final letter. So after your for loop has ended just print a new line.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
week3 × 17pset3 × 3
cs50x × 2
binary-search × 2
runoff × 2
sort × 2
plurality × 2
shorts × 2
vigenere × 1
segmentation-fault × 1
error × 1
find × 1
pointers × 1
initials × 1
search × 1
help × 1
binary × 1
argv × 1
argc × 1
algorithm × 1
videos × 1
runtime × 1
commandline × 1
is-tie × 1
lab3 × 1