Skip to main content
added 48 characters in body
Source Link
MARS
  • 5.2k
  • 3
  • 14
  • 23

"A" is a string, if you want a character, it is better to use 'A'

EDIT 2:

You have an array of pointers, I would use

char * dictionary = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char key[12];    //to copy the characters

To use a single character we can do:

key [1] = '\0';
     //for loop
         key [0] = dictionary [i];

keep in mind that string key[52] is an array of pointers

"A" is a string, if you want a character, it is better to use 'A'

EDIT:

You have an array of pointers, I would use

char * dictionary = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

To use a single character we can do:

key [1] = '\0';
     //for loop
         key [0] = dictionary [i];

EDIT 2:

You have an array of pointers, I would use

char * dictionary = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char key[12];    //to copy the characters

To use a single character we can do:

key [1] = '\0';
     //for loop
         key [0] = dictionary [i];

keep in mind that string key[52] is an array of pointers

added 258 characters in body
Source Link
MARS
  • 5.2k
  • 3
  • 14
  • 23

"A" is a string, if you want a character, it is better to use 'A'

EDIT:

You have an array of pointers, I would use

char * dictionary = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

To use a single character we can do:

key [1] = '\0';
     //for loop
         key [0] = dictionary [i];

"A" is a string, if you want a character, it is better to use 'A'

"A" is a string, if you want a character, it is better to use 'A'

EDIT:

You have an array of pointers, I would use

char * dictionary = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

To use a single character we can do:

key [1] = '\0';
     //for loop
         key [0] = dictionary [i];
Source Link
MARS
  • 5.2k
  • 3
  • 14
  • 23

"A" is a string, if you want a character, it is better to use 'A'