View Code of Problem 78

#include<stdio.h>
#include<string.h>
int main()
{
	char s1[100],s2[100],s3[100],t;
  	gets(s1);
  	gets(s2);
  	gets(s3);
  	if(strcmp(a,b)>0)
        {
        	strcpy(t,a);
          	strcpy(a,b);
          	strcpy(b,t);
        }
  	if(strcmp(a,c)>0)
        {
        	strcpy(t,a);
          	strcpy(a,c);
          	strcpy(c,t);
        }
  	if(strcmp(b,c)>0)
        {
        	strcpy(t,b);
          	strcpy(b,c);
          	strcpy(c,t);
        }
  	puts(s1);
  	puts(s2);
  	puts(s3);
  	return 0;
}
/*
Main.c: In function 'main':
Main.c:6:4: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    gets(s1);
    ^~~~
In file included from Main.c:1:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
Main.c:7:4: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    gets(s2);
    ^~~~
In file included from Main.c:1:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
Main.c:8:4: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    gets(s3);
    ^~~~
In file included from Main.c:1:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
Main.c:9:14: error: 'a' undeclared (first use in this function)
    if(strcmp(a,b)>0)
              ^
Main.c:9:14: note: each undeclared identifier is reported only once for each function it appears in
Main.c:9:16: error: 'b' undeclared (first use in this function)
    if(strcmp(a,b)>0)
                ^
Main.c:11:17: warning: passing argument 1 of 'strcpy' makes pointer from integer without a cast [-Wint-conversion]
          strcpy(t,a);
                 ^
In file included from Main.c:2:
/usr/include/string.h:121:14: note: expected 'char * restrict' but argument is of type 'char'
 extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
              ^~~~~~
Main.c:13:21: warning: passing argument 2 of 'strcpy' makes pointer from integer without a cast [-Wint-conversion]
            strcpy(b,t);
                     ^
In file included from Main.c:2:
/usr/include/string.h:121:14: note: expected 'const char * restrict' but argument is of type 'char'
 extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
              ^~~~~~
Main.c:15:16: error: 'c' undeclared (first use in this function)
    if(strcmp(a,c)>0)
                ^
Main.c:17:17: warning: passing argument 1 of 'strcpy' makes pointer from integer without a cast [-Wint-conversion]
          strcpy(t,a);
                 ^
In file included from Main.c:2:
/usr/include/string.h:121:14: note: expected 'char * restrict' but argument is of type 'char'
 extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
              ^~~~~~
Main.c:19:21: warning: passing argument 2 of 'strcpy' makes pointer from integer without a cast [-Wint-conversion]
            strcpy(c,t);
                     ^
In file included from Main.c:2:
/usr/include/string.h:121:14: note: expected 'const char * restrict' but argument is of type 'char'
 extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
              ^~~~~~
Main.c:23:17: warning: passing argument 1 of 'strcpy' makes pointer from integer without a cast [-Wint-conversion]
          strcpy(t,b);
                 ^
In file included from Main.c:2:
/usr/include/string.h:121:14: note: expected 'char * restrict' but argument is of type 'char'
 extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
              ^~~~~~
Main.c:25:21: warning: passing argument 2 of 'strcpy' makes pointer from integer without a cast [-Wint-conversion]
            strcpy(c,t);
                     ^
In file included from Main.c:2:
/usr/include/string.h:121:14: note: expected 'const char * restrict' but argument is of type 'char'
 extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
              ^~~~~~
*/

Double click to view unformatted code.


Back to problem 78