I am trying to make a programm that turns a string into binary.
int len = strlen(word);
int array2[len] = ascii_v(word, len);
int ascii_v(string w, int l)
{
int array1[l];
for (int i = 0, i < l; i++)
{
array1[i] = word[i];
return array1[l];
}
return array1[l];
}
"word" is a string that I get from the user.
The way I was planning on doing that is this: Get the word from the user, turn that word into and array of the ASCII values of each letter, turn each of the ACSII values into an array of the size 8 with with the binary code of the number: But when I tried to compile my code, I got this error: "error variable-sized object may not be initialized". I don't know what that means. Please let me know what I did wrong. I am very new to coding.