Skip to main content
3 votes
Accepted

What does argc and argv have to do with cryptography? Why are we learning about these arguments?

What do argc and argv have to do with the subject of cryptography? Nothing. But they DO have a lot to do with how you get data into a program when it is started. Just in case you didn't ...
Cliff B's user avatar
  • 69k
2 votes
Accepted

null pointer passed as argument 1

You forgot to include the relevant code. You probably call your check function with a NULL pointer. This might happen for example if you use argv[1] before checking whether argc is greater than 1 (or ...
Blauelf's user avatar
  • 21k
1 vote
Accepted

Why does `size` = `0` occur?

The code is working correctly. If it's giving a file size of 0, the file size really is zero. Maybe it was overwritten? If the file weren't there, it would gen an error. Why are you getting a file ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

Strange CL output

I have no idea what this code is doing. But that doesn't really matter. You said that the intent is to test the chars in argv[1] to see if they're digits. Well, there's absolutely no code here to do ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

Pset3: Plurality; Code doesn't consider command line arguments expect the first one!

Consider the for loop in your vote() function: It compares the candidate name with the name introduced by the voter. In the very first pass (i = 0) what happens when the candidate name and the name ...
Tritum's user avatar
  • 1,571
1 vote
Accepted

CS50 Vigenere Segmentation Fault

It looks like it will fail here else if (isalpha(argv) == 0) (I did not read the code further). argv is an array of strings. Review the man page for isalpha to be reminded that it takes a single ...
DinoCoderSaurus's user avatar
1 vote
Accepted

not satisfying the condition for input

The code is actually testing for non-alpha keys. The problem is that it is prompting for the plaintext before checking the key. It's a sequence issue. As a side issue, consider how you might make the ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

is `key` in `./caesar key` my second or third command-line argument?

in case you run your program as follows: ./caesar key you have 2 command-line arguments (i.e., argv[0] containing the name of the executable, in this case ./caesar and argv[1] containing key). so ...
kzidane's user avatar
  • 17.7k

Only top scored, non community-wiki answers of a minimum length are eligible