Question: Hi, could someone please help me with these error messages? It's not compiling properly in UNIX. My code is as follows: #include #include int main()
Hi, could someone please help me with these error messages? It's not compiling properly in UNIX.
My code is as follows:
#include
int main() {
char input[100]; printf("Enter your desired string of characters: "); gets(input);
int len = strlen(input); printf("The length of the string you entered is: %d ", len);
char output1[100]; strcpy(output1,input); printf("The copy of the string you entered is: %s ", output1);
char output2[] = "Copied String is -"; strcat(output2, input); printf("The Concatenated String is: %s ", output2);
strrev(input); printf("The reversed string is: %s ", input);
strupr(output2); printf("The String in Uppercase is: %s ", output2);
return 0;
practice.c: In function 'main': practice.c:32 : 5 : warning: 'gets, is deprecated (declared at /usr/include/stdio.h:638) [_wdeprecated-declarations gets (input); practice.c:42:5 error: IS0 C90 forbids mixed declarations and code [-Wpedantic] int len strlen(input) practice.c:54:5: error: ISO C98 forbids mixed declarations and code [-wpedantic char output1I1001 practice.c:68:5: error: ISO C90 forbids mixed declarations and code [-Wpedantic] char output2[] = "Copied String is-"; practice.c:77:5: warning: implicit declaration of function 'strrev' [-Wimplicit-function-declaration] strrev(input) strupr(output2) return 0 practice .c:84 : 5 : warning : mplicit declaration of function 'strupr, [-winplicit-function-declaration) practice.c:88:5: error: expected declaration or statement at end of input
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
