What does argv[1][i] - 64 or argv[1][i] - 96 mean? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What does argv[1][i] - 64 or argv[1][i] - 96 mean?

29th Apr 2019, 10:32 PM
B.L Sibanyoni
B.L Sibanyoni - avatar
6 Answers
+ 6
Anna true Thanks a lot much appreciated
30th Apr 2019, 10:02 PM
B.L Sibanyoni
B.L Sibanyoni - avatar
+ 6
*AsterisK* it does exactly what Anna mentioned
30th Apr 2019, 10:03 PM
B.L Sibanyoni
B.L Sibanyoni - avatar
30th Apr 2019, 5:32 AM
B.L Sibanyoni
B.L Sibanyoni - avatar
+ 4
Take char at index i of the first command line argument (argv[0] is the program name) and subtract 64 or 96, probably because char(65) is 'A' and char(97) is 'a'. The purpose of this is difficult to tell without seeing the code
30th Apr 2019, 4:21 AM
Anna
Anna - avatar
+ 3
what is the code intend to do???
30th Apr 2019, 6:50 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 3
I think it prints the letters of the second command line argument depending on their position in the alphabet ('a' will be printed once, 'b' twice, ... 'z' 26 times). B.L Sibanyoni I think there's an i++ missing in line 44
30th Apr 2019, 7:03 PM
Anna
Anna - avatar