I need to make a program that prints a string with the first character on the first line, then the second two characters on the next line. i.e Hello
H
He
Hel
Hell
Hello
Here is what I have tried so far, but I only get one letter per line.
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
for(int i = 1; i < argc; i++)
{
int wordLength = strlen(argv[i]);
for(int j = 0; j < wordLength; j++)
{
printf("%c\n", *argv + i);
}
}
return 0;
}