How to write a C Program String Example in C Programming Language ?
Solution For C Program :
//C Program String Example
#include <stdio.h>
#include <ctype.h>
int main(){
/*
When scanf gets hit
int a;
char s[1000];
scanf("%d ", &a); // Back blank:Cleared away all subsequent whitespace(' ', '\n', '\t')
gets(s);
printf("a: %d\n", a);
printf("s: %s\n", s);
*/
// (1) Blank separated with newline do: scanf("%s", &s);
// (2) Capture an entire row of word: gets(s);
char s[1005];
gets(s);
int i;
for( i = 0 ; s[i] != '\0' ; i++ ){
s[i] = toupper(s[i]);
}
printf("%s", s);
return 0;
}