What is wrong with this code???

0 dusan tisma · April 15, 2015
the object of the code is to look at the password that the user input and see if it has a symbol, a number and a capital letter.
Mine doesnt appear to print "You need a symbol!". Please help


Post a Reply


Oldest  Newest  Rating
0 c student · April 16, 2015
perhaps this is your problem?
0 Dol Lod · April 15, 2015
To start off with, you have undefined checking for characters using the null byte as a limiter. You don't necessarily know the value of a character whose value has not been set yet.  You have to use the length of the array unless you actually change the last value to the null byte. I personally would memset password to the null byte to start off with so you can easily know how long the string is. The strlen function would use the null byte as a limiter for calculating hte string length. 

Additionally I would change those halfway ternary statements to using if statements b/c I don't think that is write syntax and you don't account for the else case. 
  • 1



One of the most popular languages of all time.

Bucky Roberts Administrator