i made a program which converts lower case to upper case a string.i know how to convert a char to upper case via preprocessor directives but i dont know how to do it for a string.
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
#define UPPER([]) ([]-32)
void fstring_convert(char string[]);
void main(void)
{
char string[40];
printf("Enter a string:");
gets(string);
fstring_convert(string);
printf("%s",string);
getch();
}
void fstring_convert(char string[])
{
int i;
for(i=0; ;i++)
{
if(string[i]==' ')
{
string[i]=string[i+1];
}
if(isdigit(string[i]))
{
string[i]+=1;
}
UPPER('string[i]');
if(string[i]=='\0')
break;
}
}