Hot answers tagged

3 votes
Accepted

Vigenere Segmentation understanding

This is a very, very common error for new programmers. The problem is the actual call to isalpha(). The isalpha() function takes a single char as input, but argv[1] is a string, not a char. Simply ...
user avatar
  • 63.1k
3 votes
Accepted

Vigenere -Isalpha only checking first char of key

Both clauses of the if/else contain return statements. When a return statement is encountered, it will immediately return control to the calling program with no further processing in the current ...
user avatar
  • 63.1k
2 votes
Accepted

What is the return value when isalpha() evaluates to true?

The problem is a lack of understanding of how many of these functions work. While you would think that isalpha() would return a bool, it doesn't. Instead, it returns a number. If it is false, it ...
user avatar
  • 63.1k
1 vote
Accepted

Isalpha not working for all char of my string

There are a couple issues here. First, there's a known issue with debug50. For certain library functions, if you "step into" the line of code with the function call, debug50 will try to step ...
user avatar
  • 63.1k
1 vote
Accepted

pset2 substitution - isalpha doesn't seem to recognize letters

You've run into a common newbie problem. The issue lies in this code: if ( isalpha ( c ) != 'true' ) The issue is with the return value of isalpha and what you're comparing it to. Let's handle ...
user avatar
  • 63.1k
1 vote

pset2 substitution - isalpha doesn't seem to recognize letters

I am not a Pro, too, but the first thing I see is the "isalpha(c) != "true" -> When I recall this pset correctly, isalpha() does not return "false" or "true" but 0 or 1. But if the statement would be ...
user avatar
  • 88
1 vote
Accepted

Pset2, caesar: string characters not working with is alpha logic?

The problem is surely in the return value of the isalpha function and the value of true, for what the condition is true both values must be equal, which apparently does not happen, keep in mind that ...
user avatar
  • 5,172
1 vote
Accepted

C: Trouble with isalpha and char* - Error: expected expression

I guess you mean if (isalpha(word[i])), with word being a char[] or char*, and i being something like an int? Could you maybe clarify your question by adding the surrounding code to your question?
user avatar
  • 20.7k
1 vote
Accepted

pset2 how to use ctype.h functions

isalpha() takes a single character. When you try to jam a complete string down its throat, it chokes and coughs up a seg fault. You need to loop through the string and test each char individually. If ...
user avatar
1 vote
Accepted

C prog - COUNTER to find the number of alphanumeric's character in a string?

Your problem is pretty simple. In a for loop, after the end of each loop, the third parameter (<increment command>) of the loop is executed, every time. for (<initialization>; <...
user avatar
  • 7,326

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