fork download
  1. LAB6P2
  2.  
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <conio.h>
  6.  
  7. void length(char[s])
  8. {
  9. int c=0;
  10. while (s[c] != '\0')
  11. c++;
  12. return 0;
  13. }
  14.  
  15. int main()
  16. {
  17. int i,a;
  18. char string[200];
  19. printf("Please input string:\n");
  20. scanf("%s",string);
  21. a = length(string);
  22. printf("The length of \"%s\ is:" = %d\n", s, length);
  23. getch();
  24. return 0;
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
In file included from /usr/include/stdio.h:33:0,
                 from prog.c:3:
/usr/lib/gcc/i586-linux-gnu/4.9/include/stddef.h:212:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
 typedef __SIZE_TYPE__ size_t;
 ^
In file included from /usr/include/stdio.h:74:0,
                 from prog.c:3:
/usr/include/libio.h:306:3: error: unknown type name 'size_t'
   size_t __pad5;
   ^
/usr/include/libio.h:310:67: error: 'size_t' undeclared here (not in a function)
   char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
                                                                   ^
/usr/include/libio.h:338:62: error: expected declaration specifiers or '...' before 'size_t'
 typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
                                                              ^
/usr/include/libio.h:347:6: error: expected declaration specifiers or '...' before 'size_t'
      size_t __n);
      ^
/usr/include/libio.h:469:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '_IO_sgetn'
 extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t);
                   ^
In file included from prog.c:3:0:
/usr/include/stdio.h:319:35: error: expected declaration specifiers or '...' before 'size_t'
 extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
                                   ^
/usr/include/stdio.h:325:47: error: expected declaration specifiers or '...' before 'size_t'
 extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur;
                                               ^
/usr/include/stdio.h:337:20: error: expected declaration specifiers or '...' before 'size_t'
       int __modes, size_t __n) __THROW;
                    ^
/usr/include/stdio.h:344:10: error: expected declaration specifiers or '...' before 'size_t'
          size_t __size) __THROW;
          ^
/usr/include/stdio.h:386:44: error: expected declaration specifiers or '...' before 'size_t'
 extern int snprintf (char *__restrict __s, size_t __maxlen,
                                            ^
/usr/include/stdio.h:390:45: error: expected declaration specifiers or '...' before 'size_t'
 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
                                             ^
/usr/include/stdio.h:666:11: error: expected declaration specifiers or '...' before 'size_t'
           size_t *__restrict __n, int __delimiter,
           ^
/usr/include/stdio.h:669:9: error: expected declaration specifiers or '...' before 'size_t'
         size_t *__restrict __n, int __delimiter,
         ^
/usr/include/stdio.h:679:8: error: expected declaration specifiers or '...' before 'size_t'
        size_t *__restrict __n,
        ^
/usr/include/stdio.h:709:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fread'
 extern size_t fread (void *__restrict __ptr, size_t __size,
               ^
/usr/include/stdio.h:715:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fwrite'
 extern size_t fwrite (const void *__restrict __ptr, size_t __size,
               ^
/usr/include/stdio.h:737:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fread_unlocked'
 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
               ^
/usr/include/stdio.h:739:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fwrite_unlocked'
 extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
               ^
In file included from prog.c:4:0:
/usr/include/string.h:47:8: error: expected declaration specifiers or '...' before 'size_t'
        size_t __n) __THROW __nonnull ((1, 2));
        ^
/usr/include/string.h:50:56: error: expected declaration specifiers or '...' before 'size_t'
 extern void *memmove (void *__dest, const void *__src, size_t __n)
                                                        ^
/usr/include/string.h:59:18: error: expected declaration specifiers or '...' before 'size_t'
         int __c, size_t __n)
                  ^
/usr/include/string.h:66:42: error: expected declaration specifiers or '...' before 'size_t'
 extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
                                          ^
/usr/include/string.h:69:56: error: expected declaration specifiers or '...' before 'size_t'
 extern int memcmp (const void *__s1, const void *__s2, size_t __n)
                                                        ^
/usr/include/string.h:96:48: error: expected declaration specifiers or '...' before 'size_t'
 extern void *memchr (const void *__s, int __c, size_t __n)
                                                ^
/usr/include/string.h:133:39: error: expected declaration specifiers or '...' before 'size_t'
         const char *__restrict __src, size_t __n)
                                       ^
/usr/include/string.h:141:9: error: expected declaration specifiers or '...' before 'size_t'
         size_t __n) __THROW __nonnull ((1, 2));
         ^
/usr/include/string.h:147:57: error: expected declaration specifiers or '...' before 'size_t'
 extern int strncmp (const char *__s1, const char *__s2, size_t __n)
                                                         ^
/usr/include/string.h:154:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'strxfrm'
 extern size_t strxfrm (char *__restrict __dest,
               ^
In file included from prog.c:4:0:
/usr/include/string.h:169:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'strxfrm_l'
 extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
               ^
/usr/include/string.h:184:45: error: expected declaration specifiers or '...' before 'size_t'
 extern char *strndup (const char *__string, size_t __n)
                                             ^
/usr/include/string.h:285:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'strcspn'
 extern size_t strcspn (const char *__s, const char *__reject)
               ^
/usr/include/string.h:289:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'strspn'
 extern size_t strspn (const char *__s, const char *__accept)
               ^
/usr/include/string.h:399:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'strlen'
 extern size_t strlen (const char *__s)
               ^
/usr/include/string.h:406:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'strnlen'
 extern size_t strnlen (const char *__string, size_t __maxlen)
               ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from prog.c:3:
/usr/include/string.h:427:12: error: expected declaration specifiers or '...' before 'size_t'
 extern int __REDIRECT_NTH (strerror_r,
            ^
In file included from prog.c:4:0:
/usr/include/string.h:451:33: error: expected declaration specifiers or '...' before 'size_t'
 extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
                                 ^
/usr/include/string.h:455:53: error: expected declaration specifiers or '...' before 'size_t'
 extern void bcopy (const void *__src, void *__dest, size_t __n)
                                                     ^
/usr/include/string.h:459:31: error: expected declaration specifiers or '...' before 'size_t'
 extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
                               ^
/usr/include/string.h:462:54: error: expected declaration specifiers or '...' before 'size_t'
 extern int bcmp (const void *__s1, const void *__s2, size_t __n)
                                                      ^
/usr/include/string.h:538:61: error: expected declaration specifiers or '...' before 'size_t'
 extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
                                                             ^
/usr/include/string.h:575:34: error: expected declaration specifiers or '...' before 'size_t'
    const char *__restrict __src, size_t __n)
                                  ^
/usr/include/string.h:578:39: error: expected declaration specifiers or '...' before 'size_t'
         const char *__restrict __src, size_t __n)
                                       ^
In file included from /usr/include/string.h:635:0,
                 from prog.c:4:
/usr/include/i386-linux-gnu/bits/string2.h:945:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__strcspn_c1'
 __STRING_INLINE size_t __strcspn_c1 (const char *__s, int __reject);
                        ^
/usr/include/i386-linux-gnu/bits/string2.h:947:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__strcspn_c1'
 __strcspn_c1 (const char *__s, int __reject)
 ^
/usr/include/i386-linux-gnu/bits/string2.h:955:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__strcspn_c2'
 __STRING_INLINE size_t __strcspn_c2 (const char *__s, int __reject1,
                        ^
/usr/include/i386-linux-gnu/bits/string2.h:958:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__strcspn_c2'
 __strcspn_c2 (const char *__s, int __reject1, int __reject2)
 ^
/usr/include/i386-linux-gnu/bits/string2.h:967:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__strcspn_c3'
 __STRING_INLINE size_t __strcspn_c3 (const char *__s, int __reject1,
                        ^
/usr/include/i386-linux-gnu/bits/string2.h:970:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__strcspn_c3'
 __strcspn_c3 (const char *__s, int __reject1, int __reject2,
 ^
/usr/include/i386-linux-gnu/bits/string2.h:1021:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__strspn_c1'
 __STRING_INLINE size_t __strspn_c1 (const char *__s, int __accept);
                        ^
/usr/include/i386-linux-gnu/bits/string2.h:1023:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__strspn_c1'
 __strspn_c1 (const char *__s, int __accept)
 ^
/usr/include/i386-linux-gnu/bits/string2.h:1032:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__strspn_c2'
 __STRING_INLINE size_t __strspn_c2 (const char *__s, int __accept1,
                        ^
/usr/include/i386-linux-gnu/bits/string2.h:1035:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__strspn_c2'
 __strspn_c2 (const char *__s, int __accept1, int __accept2)
 ^
/usr/include/i386-linux-gnu/bits/string2.h:1044:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__strspn_c3'
 __STRING_INLINE size_t __strspn_c3 (const char *__s, int __accept1,
                        ^
/usr/include/i386-linux-gnu/bits/string2.h:1047:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__strspn_c3'
 __strspn_c3 (const char *__s, int __accept1, int __accept2, int __accept3)
 ^
/usr/include/i386-linux-gnu/bits/string2.h: In function '__strpbrk_c2':
/usr/include/i386-linux-gnu/bits/string2.h:1105:50: error: expected ';' before '__s'
   return *__s == '\0' ? NULL : (char *) (size_t) __s;
                                                  ^
/usr/include/i386-linux-gnu/bits/string2.h: In function '__strpbrk_c3':
/usr/include/i386-linux-gnu/bits/string2.h:1117:50: error: expected ';' before '__s'
   return *__s == '\0' ? NULL : (char *) (size_t) __s;
                                                  ^
In file included from /usr/include/i386-linux-gnu/bits/string2.h:1273:0,
                 from /usr/include/string.h:635,
                 from prog.c:4:
/usr/include/stdlib.h: At top level:
/usr/include/stdlib.h:466:22: error: expected declaration specifiers or '...' before 'size_t'
 extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
                      ^
/usr/include/stdlib.h:468:22: error: expected declaration specifiers or '...' before 'size_t'
 extern void *calloc (size_t __nmemb, size_t __size)
                      ^
/usr/include/stdlib.h:468:38: error: expected declaration specifiers or '...' before 'size_t'
 extern void *calloc (size_t __nmemb, size_t __size)
                                      ^
In file included from /usr/include/string.h:635:0,
                 from prog.c:4:
/usr/include/i386-linux-gnu/bits/string2.h:1297:47: error: expected declaration specifiers or '...' before 'size_t'
 extern char *__strndup (const char *__string, size_t __n)
                                               ^
prog.c:5:19: fatal error: conio.h: No such file or directory
 #include <conio.h>
                   ^
compilation terminated.
stdout
Standard output is empty