Questions tagged [argc]

The tag has no usage guidance.

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

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

I understand what these arguments do--take inputs before the program starts to in some way influence the program. But they seem to have been shoe-horned into the lecture. David moves on from this ...
Tanishq Kumar's user avatar
0 votes
1 answer
63 views

PSet 2 - Why will it still pass negative numbers?

I am working on pset2 Caesar. I have everything done except for the fact that my program allows you to pass negative numbers as a key. Here is my code: #include <cs50.h> #include <ctype.h>...
Jacob Pieczynski's user avatar
1 vote
1 answer
224 views

why argc is not counting all commands?

In command line argument example when we run program, it count all cmd argument but in case argc is 2 ? why not 4 ?
Pritesh Kumar's user avatar
0 votes
1 answer
31 views

week3 lecture very beginning

Week3 Lecture: A student asked a question of my mind how do computer know about the argc ? I really don't understand how is this argc working In case we printed "zymla" we gave argv[1] as our first ...
Habib ur Rehman's user avatar
0 votes
1 answer
298 views

caesar argc ... help me get started

Ok so i just started caesar and i don't know whether I'm headed in the right direction or not, if not i just need someone to point me the right way,and yes i have seen the walkthrough. so heres my ...
Nilabha Chatterjee's user avatar
0 votes
1 answer
75 views

How can I display "< key>" on the same line if argc != 2?

How can I display "< key>" on the same line if argc != 2? Example: check50 2014.fall.pset2.caesar caesar.c
Pascal's user avatar
  • 101
0 votes
2 answers
717 views

How to check string argv[] for errors?

hope I can get some help here. I'm only at week 3 in CS50 and wanted to play around with command-line arguments a bit before moving on. I got this working (diagonalizing input), but couldn't figure ...
pqs183's user avatar
  • 3
4 votes
2 answers
2k views

How to handle "lack of argv[1]"

I have my code set up so that if argc doesn't equal 2 the main function will return 1. Per the specs I thought. But I keep getting the error that I didn't "handle lack of argv[1]". if (argc != 2) ...
Brian Hodges's user avatar
0 votes
2 answers
2k views

Can someone explain me the point of the "int k = atoi((argv[1]);"?

I know that the answer seems obvious but I will explain further the reason for my question: in my program I only used for the key int k = GetInt() without the argv, argc etc. and the program seems to ...
GiP's user avatar
  • 31
1 vote
1 answer
1k views

char* text = (argc == 3) ? argv[2] : argv[1];

Could someone explain me what the line in the title actually does? Am I correct if argc is 3 char* text is argv[2] else char* text is argv[1] ? If so, how do the operators work in this ...
Jesse's user avatar
  • 157
0 votes
3 answers
2k views

Segmentation Fault and Returning 1

If I declare int key before my if (argc != 2), I get a segmentation fault (core dumped) message when I run the program with only one command-line argument. However if I declared int key after the if ...
Adam Wilson's user avatar