My aim is to create a program that:
1. reads in a string of less than 255 characters from the user into a variable called array1
2. copies array1 into a variable called array2, converting each element of array1 to UPPER CASE
3. prints out the contents of array2
I cant seem to do part 2 or 3 and I do not even know if part 1 is correct! :(
here is my code:
#include <stdio.h>
#include "simpleio.h"
char array1[256];
char array2[256];
int i;
int main()
{
printf("Please enter string of text max 255 characters \n");
getString(array1,255);
for(i=0; array1[i] != '\0';i++)
{
if((array2[i] <= 'a') ||(array2[i] >= 'z')) //if value is greater than decimal ascii A convert LOWER to UPPER CASE
{
array2[i] += 32;
}
array2[i]=array1[i];
printf("%c",array2[i]);
}
printf("\n");
return 0;
}
any help please. Thanks.