2

This is the error I get:

vigenere.c:34:34: error: incompatible integer to pointer
  conversion passing 'char' to parameter of type
  'const char *'; take the address with &
  [-Werror,-Wint-conversion]
        int running_k = atoi(k[step]);

What does it mean? What went wrong?

3

The types char, short, int, long int, and long long int are often referred to as integer types.

Per its manual, the function atoi takes a value of type const char *. I assume your variable named k is of type char [] or char * in which case k[step] would actually be of type char.

There is no implicit conversion of an integer type to a pointer type and that is why you are getting this warning/error.

To fix that, you should pass a string to atoi rather than a char.

| improve this answer | |
  • or avoid atoi() altogether? – daniel Feb 11 '15 at 10:13
  • @daniel I'm not really sure what you're trying to do so I prefer leaving the decision to you! :) – Kareem Feb 11 '15 at 10:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .