i couldn't follow the logics of your program. you basically had a for loop that iterated through a char array and upon each iteration you sent the char array to checkupper that still iterated through the char array once again? consider the following.
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int checkupper(char*s);
void converttoupper(char * c);
int main(void)
{
// declare the user char arrays to store the strings
char user_x1[256] ;
//char convert;
int length;
//int i,e;
//int ar_size;
printf("Enter a String: ");
fgets( user_x1, 256, stdin ); //fgets (char string, int size, file *stream
length = strlen(user_x1);
//printf("%d",length);
//ar_size=length-1;
//printf("\n\nlength of the string: %d\n",length);
//printf("\n\narray size of the string: %d\n",ar_size);
system("cls");
user_x1[length] = '\0';
converttoupper(user_x1);
printf("%s\n", user_x1);
/*
for(i=0;i<=ar_size;i++) //for loop to CALL FUNCTION TO CONVERT TO UPPER
{
convert = checkupper(user_x1);
}
printf("User converted string: %c",user_x1);
for(i=0;i<=ar_size;i++)
{
printf("%C ",user_x1[i]);
}
*/
//system("pause");
getchar();
return 0;
}
void converttoupper(char * c)
{
while(*c)
{
if(123 > (int)(*c) && (int)(*c) > 96)
*c -= 32;
c++;
}
return;
}
int checkupper(char*con)
{
while(*con)*con>96&*con<123?*con-=32:0,con++;
}