File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <stdlib.h>
3
+ #include <string.h>
4
+ #include <errno.h>
5
+
6
+ /****************002-joseph.c***********************
7
+
8
+ 使用没有头节点但是要有首元节点的链式存储结构来解决此问题,因为方便删除元素
9
+ ***************************************************/
10
+
11
+ typedef struct _joseph {
12
+ char data ; //a b c d e f
13
+ struct _joseph * next ;
14
+ }joseph ;
15
+
16
+ static void josp_init (joseph * * josp , int people )
17
+ {
18
+ while (people -- ) { //malloc ?
19
+ }
20
+ }
21
+
22
+ int main (int argc , char * * argv )
23
+ {
24
+ joseph * josp ;
25
+ int people , hit ;
26
+
27
+ if (argc < 3 ) {
28
+ fprintf (stderr , "Please read usage: ./a.out 24 5 error: %s: \n" , strerror (errno ));
29
+ exit (-1 );
30
+ }
31
+
32
+ people = atoi (argv [1 ]);
33
+ hit = atoi (argv [2 ]);
34
+ printf ("p %d h %d\n" , people , hit );
35
+
36
+ josp_init (& josp , people );
37
+
38
+ return 0 ;
39
+ }
You can’t perform that action at this time.
0 commit comments