I am trying to convert my 'char' to a 'string'. I have tried looking it up online, but to no avail. Any suggestions?
1 Answer
A string is an array, therefore you can access it using brackets and the number of the place you want to put the char.
#include <stdio.h>
#include <cs50.h>
int main(void)
{
char letter = 'y';
string letterConvert = malloc(sizeof(char)*10);
letterConvert[0] = letter;
printf("%s\n", letterConvert);
}