Hi everyone so I have started learning strings in c and I get a problem. I have been changing initialized strings to uppercase or lower case and its easy. But I am having some trouble changing user input to uppercase. Here is a simple program which will take user input and count the string length and is suppossed to also capitalize the input.
Thanks Guys!!
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(int argc, const char * argv[])
{
char name[10];
int x = 0;
//get user input of name
printf("Enter your name: ");
scanf("%s",&name[10]);
printf("Your name has %lu letters.", strlen(&name[10]));//Length
//Having problem over here I need to print the string in uppercase
for ( x = 0; x < strlen(&name[10]) ; x++){
printf("%c",toupper(name[x]));
}
return 0;
}