I'm working on the pset2 Bulbs problem and I've come to a place where I don't know what to do next. This code takes user text input and converts it to ascii; I can see that the array is being filled as the loop iterates through the input text, but I can't access that array and return it outside of the loop. I want to have this array accessible for the next step of the problem. how can I pass the array out at the end of the loop (with return or something similar) to be able to pass it on to the next step of the problem?
#include <cs50.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
const int BITS_IN_BYTE = 8;
int letters_to_ascii(string sentence);
void print_bulb(int bit);
int main(void)
{
// Get input text from user
string sentence = get_string("Enter text here: ");
int output = letters_to_ascii(sentence);
}
int letters_to_ascii(string sentence)
{
int n = 0;
int i = 0;
int ascii[strlen(sentence)];
while (sentence[n] != '\0')
{
//printf("%d ",sentence[n]);
ascii[i] = sentence[n];
printf("%i ", ascii[i]);
n++;
i++;
}
printf("\n");
return n;
}