View Code of Problem 114

#include <stdio.h>
int main() {
	char a[1000];
	while (gets(a)!=NUll)
	{
		int k;
		int len = strlen(a);
		for (int i = 0; i < len; i++)
		{
			int leng =0;
			if (a[i]==' ')
			{
				printf(" ");
			}
			else {
			
				k = i;
				while (a[k + 1] != ' ')
				{
					k++;
					leng++;
				}
				for (int j = k; j >= i; j--)
				{
					printf("%c", a[j]);					
				}
				i = i + leng;
			
			}
		}
		printf("\n");

	}


	return 0;
}
/*
Main.c: In function 'main':
Main.c:4:2: warning: 'gets' is deprecated [-Wdeprecated-declarations]
  while (gets(a)!=NUll)
  ^~~~~
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:4:18: error: 'NUll' undeclared (first use in this function); did you mean 'NULL'?
  while (gets(a)!=NUll)
                  ^~~~
                  NULL
Main.c:4:18: note: each undeclared identifier is reported only once for each function it appears in
Main.c:7:13: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   int len = strlen(a);
             ^~~~~~
Main.c:7:13: warning: incompatible implicit declaration of built-in function 'strlen'
Main.c:7:13: note: include '<string.h>' or provide a declaration of 'strlen'
Main.c:2:1:
+#include <string.h>
 int main() {
Main.c:7:13:
   int len = strlen(a);
             ^~~~~~
*/

Double click to view unformatted code.


Back to problem 114