I am working on a program that allows a user to enter a string and the program converts every letter, via a custom function, from lowercase to uppercase. It works somewhat well, but it will not display the entire string at runtime. How do I fix this?
this is the function prototype:
this is the function definition:
and here is the program source:
When trying to fix this myself, I tried specifying a size directly and through
However, only the first word showed up. I even tried editing the function definition, but that would not display the entire string either.
this is the function prototype:
Code:
void capitalize(char string[]);
this is the function definition:
Code:
#include <stdio.h>
void capitalize(char string[])
{
int size = sizeof(string)/sizeof(char);
int count = 0, count2 = 0;
for (count; count <= size -1; count++)
{
if (string[count] >= 97 && string[count] < 123 && string[count != '\0')
{
string[count] -= 32;
}
}
for (count2; count2 <= size -1; count2++)
{
printf("%c", string[count2]);
}
printf("\n");
}
and here is the program source:
Code:
#include <stdio.h>
#include "convert.h"
int main()
{
char line[sizeof(char)];
printf("Enter a string: ");
scanf("%s", line);
capitalize(line);
return 0;
}
When trying to fix this myself, I tried specifying a size directly and through
Code:
#define <word> <size>
However, only the first word showed up. I even tried editing the function definition, but that would not display the entire string either.