Language: C

Last login: Sat Dec  8 21:52:03 on ttys002
sakataharukanoMacBook-ea:~ sakataharuka$ emacs test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
test.c:12:16: warning: format specifies type 'int *' but the argument has type
      'int' [-Wformat]
    scanf("%d",h[i]);
           ~~  ^~~~
test.c:16:7: warning: implicit declaration of function 'print' is invalid in C99
      [-Wimplicit-function-declaration]
      print("%d",h[i]);
      ^
2 warnings generated.
Undefined symbols for architecture x86_64:
  "_print", referenced from:
      _main in test-fdaa18.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
sakataharukanoMacBook-ea:~ sakataharuka$ emacs test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
test.c:16:7: warning: implicit declaration of function 'print' is invalid in C99
      [-Wimplicit-function-declaration]
      print("%d",h[i]);
      ^
1 warning generated.
Undefined symbols for architecture x86_64:
  "_print", referenced from:
      _main in test-d39eac.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
sakataharukanoMacBook-ea:~ sakataharuka$ emacs test.c
sakataharukanoMacBook-ea:~ sakataharuka$ emacs test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
5
7
5
7
7
54587592147352576347340817922147352571sakataharukanoMacBook-ea:~ sakataharuka$ emacst test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
5 7 5 7 7
557772sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
5 7 5 7 7
-6sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
5 7 5 7 7
0sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
5 7 5 7 7
5 - 7? 5 - 7? 7 - 7? 7 - 32766? 7 - 3522021? 0sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
5 7 5 7 7
5 - 7? 5 - 7? 7 - 7? 0sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
10 15 11 14 12
10 - 14? 11 - 15? 14 - 12? -2sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
10 15 11 14 12
-2sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
10 15 11 14 12
14 - 1015 - 1112 - 14-2sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
10 15 11 14 12
14 - 1015 - 1112 - 14-2sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
10 15 11 14 12
14 - 104sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
10 15 11 14 12
14 - 1015 - 114sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
10 15 11 14 12
10114sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
10 15 11 14 12
101114-2sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
printf("%d",h[i]);
0000-311129488-311129488sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
10 15 11 14 12    
1011141512-2sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
10 15 11 14 12 
10111214152sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
sakataharukanoMacBook-ea:~ sakataharuka$ gcc test.c
sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
10 15 11 14 12 
2sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
5 3
5
7
5
7
7
0sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c

#include<stdio.h>
#include<stdlib.h>
int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main(){
  int N,K,input,min=100000;
  scanf("%d %d",&N,&K);//NからKとる                                             
  int h[N];
  for(int i=0;i<N;i++){
    scanf("%d",&h[i]);
  }
  qsort(h,sizeof(h) / sizeof(*h), sizeof(*h),asc);
  //for(int i=0;i<N;i++)printf("%d",h[i]);                                      
    for(int i=0;i<=N-K;i++){
      //5こから3ことる場合、01234から、0と2をとる、から,2から4とる、までの3回   
      //0から5-3番目まで,0から3-1番目を比較                                     
      //printf("%d - %d",h[i+K-1],h[i]);                                        
      if(min>(h[i+K-1]-h[i]))min=h[i+K-1]-h[i];
    }

-uuu:---F1  test.c         Top L1     (C/l Abbrev)------------------------------



Compiler output:
main.c:1:1: error: unknown type name 'Last'
    1 | Last login: Sat Dec  8 21:52:03 on ttys002
      | ^~~~
main.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
    1 | Last login: Sat Dec  8 21:52:03 on ttys002
      |           ^
main.c:4:46: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    4 | test.c:12:16: warning: format specifies type 'int *' but the argument has type
      |                                              ^~~~~~~
main.c:5:7: warning: multi-character character constant [-Wmultichar]
    5 |       'int' [-Wformat]
      |       ^~~~~
main.c:7:12: error: expected identifier or '(' before '~' token
    7 |            ~~  ^~~~
      |            ^
main.c:8:56: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    8 | test.c:16:7: warning: implicit declaration of function 'print' is invalid in C99
      |                                                        ^~~~~~~
main.c:11:7: error: expected identifier or '(' before '^' token
   11 |       ^
      |       ^
main.c:20:56: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   20 | test.c:16:7: warning: implicit declaration of function 'print' is invalid in C99
      |                                                        ^~~~~~~
main.c:23:7: error: expected identifier or '(' before '^' token
   23 |       ^
      |       ^
main.c:40:1: error: invalid suffix "sakataharukanoMacBook" on integer constant
   40 | 54587592147352576347340817922147352571sakataharukanoMacBook-ea:~ sakataharuka$ emacst test.c
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:45:1: error: invalid suffix "sakataharukanoMacBook" on integer constant
   45 | 557772sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:51:2: error: invalid suffix "sakataharukanoMacBook" on integer constant
   51 | -6sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      |  ^~~~~~~~~~~~~~~~~~~~~~
main.c:56:1: error: invalid suffix "sakataharukanoMacBook" on integer constant
   56 | 0sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      | ^~~~~~~~~~~~~~~~~~~~~~
main.c:61:46: error: invalid suffix "sakataharukanoMacBook" on integer constant
   61 | 5 - 7? 5 - 7? 7 - 7? 7 - 32766? 7 - 3522021? 0sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      |                                              ^~~~~~~~~~~~~~~~~~~~~~
main.c:66:22: error: invalid suffix "sakataharukanoMacBook" on integer constant
   66 | 5 - 7? 5 - 7? 7 - 7? 0sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      |                      ^~~~~~~~~~~~~~~~~~~~~~
main.c:70:29: error: invalid suffix "sakataharukanoMacBook" on integer constant
   70 | 10 - 14? 11 - 15? 14 - 12? -2sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      |                             ^~~~~~~~~~~~~~~~~~~~~~
main.c:75:2: error: invalid suffix "sakataharukanoMacBook" on integer constant
   75 | -2sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      |  ^~~~~~~~~~~~~~~~~~~~~~
main.c:80:23: error: invalid suffix "sakataharukanoMacBook" on integer constant
   80 | 14 - 1015 - 1112 - 14-2sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      |                       ^~~~~~~~~~~~~~~~~~~~~~
main.c:85:23: error: invalid suffix "sakataharukanoMacBook" on integer constant
   85 | 14 - 1015 - 1112 - 14-2sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      |                       ^~~~~~~~~~~~~~~~~~~~~~
main.c:91:6: error: invalid suffix "sakataharukanoMacBook" on integer constant
   91 | 14 - 104sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:96:13: error: invalid suffix "sakataharukanoMacBook" on integer constant
   96 | 14 - 1015 - 114sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:102:1: error: invalid suffix "sakataharukanoMacBook" on integer constant
  102 | 10114sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:108:8: error: invalid suffix "sakataharukanoMacBook" on integer constant
  108 | 101114-2sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      |        ^~~~~~~~~~~~~~~~~~~~~~
main.c:113:1: error: expected identifier or '(' before numeric constant
  113 | 0000-311129488-311129488sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      | ^~~~
main.c:113:16: error: invalid suffix "sakataharukanoMacBook" on integer constant
  113 | 0000-311129488-311129488sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:117:12: error: invalid suffix "sakataharukanoMacBook" on integer constant
  117 | 1011141512-2sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      |            ^~~~~~~~~~~~~~~~~~~~~~
main.c:123:1: error: invalid suffix "sakataharukanoMacBook" on integer constant
  123 | 10111214152sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:128:1: error: invalid suffix "sakataharukanoMacBook" on integer constant
  128 | 2sakataharukanoMacBook-ea:~ sakataharuka$ ./a.out
      | ^~~~~~~~~~~~~~~~~~~~~~
main.c:135:1: error: invalid suffix "sakataharukanoMacBook" on integer constant
  135 | 0sakataharukanoMacBook-ea:~ sakataharuka$ emacs  test.c
      | ^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:47,
                 from main.c:137:
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:28:43: error: unknown type name 'size_t'
   28 |                                           size_t __nbytes);
      |                                           ^~~~~~
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:1:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
  +++ |+#include <stddef.h>
    1 | /* Copyright (C) 1991-2025 Free Software Foundation, Inc.
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:37:44: error: unknown type name 'size_t'
   37 |                                            size_t __nbytes);
      |                                            ^~~~~~
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:37:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:57:3: error: unknown type name 'cookie_read_function_t'; did you mean 'cookie_seek_function_t'?
   57 |   cookie_read_function_t *read;         /* Read bytes.  */
      |   ^~~~~~~~~~~~~~~~~~~~~~
      |   cookie_seek_function_t
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:58:3: error: unknown type name 'cookie_write_function_t'; did you mean 'cookie_close_function_t'?
   58 |   cookie_write_function_t *write;       /* Write bytes.  */
      |   ^~~~~~~~~~~~~~~~~~~~~~~
      |   cookie_close_function_t
/usr/include/stdio.h:314:35: error: unknown type name 'size_t'
  314 | extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
      |                                   ^~~~~~
/usr/include/stdio.h:130:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
  129 | #include <bits/stdio_lim.h>
  +++ |+#include <stddef.h>
  130 | 
/usr/include/stdio.h:320:47: error: unknown type name 'size_t'
  320 | extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW
      |                                               ^~~~~~
/usr/include/stdio.h:320:47: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:340:34: error: unknown type name 'size_t'
  340 |                     int __modes, size_t __n) __THROW __nonnull ((1));
      |                                  ^~~~~~
/usr/include/stdio.h:340:34: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:346:24: error: unknown type name 'size_t'
  346 |                        size_t __size) __THROW __nonnull ((1));
      |                        ^~~~~~
/usr/include/stdio.h:346:24: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:385:44: error: unknown type name 'size_t'
  385 | extern int snprintf (char *__restrict __s, size_t __maxlen,
      |                                            ^~~~~~
/usr/include/stdio.h:385:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:389:45: error: unknown type name 'size_t'
  389 | extern int vsnprintf (char *__restrict __s, size_t __maxlen,
      |                                             ^~~~~~
/usr/include/stdio.h:389:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:690:30: error: unknown type name 'size_t'
  690 |                              size_t *__restrict __n, int __delimiter,
      |                              ^~~~~~
/usr/include/stdio.h:690:30: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:693:28: error: unknown type name 'size_t'
  693 |                            size_t *__restrict __n, int __delimiter,
      |                            ^~~~~~
/usr/include/stdio.h:693:28: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:698:27: error: unknown type name 'size_t'
  698 |                           size_t *__restrict __n,
      |                           ^~~~~~
/usr/include/stdio.h:698:27: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:728:8: error: unknown type name 'size_t'
  728 | extern size_t fread (void *__restrict __ptr, size_t __size,
      |        ^~~~~~
/usr/include/stdio.h:728:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fi