I'm trying to generate two independent characters arrays. The first one must contain the alphabet in lowercase and the second one, in uppercase. My code works but in the second case, the output contain the two arrays one after the other. Can someone explain me why it does? Thanks
#include <stdio.h>
#include <stdlib.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
char lowcase[26], uppercase[26];
int i = 0, j = 0;
for ( ; i < 26; i++)
{
lowcase[i] = (char)(i+(int)('a'));
}
for ( ; j < 26; j++)
{
uppercase[j] = (char)(j+(int)('A'));
}
printf("%s\n%s\n", lowcase, uppercase);
}
Here the output :
jharvard@appliance (~/Dropbox/pset2): ./alphabet
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
jharvard@appliance (~/Dropbox/pset2):