fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. struct TWICE{
  5. int value;
  6. struct TWICE *next;
  7. };
  8.  
  9. int main(){
  10. int count, i;
  11. scanf("%d", &count); //指定能有幾個節點
  12.  
  13. TWICE *head = new TWICE(); //取得一個和 TWICE 大小一樣的區塊,然後配給 head 這個指標
  14. int age;
  15. scanf("%d", &age);
  16. }
Compilation error #stdin compilation error #stdout 0s 9280KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:13:3: error: unknown type name ‘TWICE’
   TWICE *head = new TWICE(); //取得一個和 TWICE 大小一樣的區塊,然後配給 head 這個指標
   ^~~~~
prog.c:13:3: note: use ‘struct’ keyword to refer to the type
prog.c:13:17: error: ‘new’ undeclared (first use in this function)
   TWICE *head = new TWICE(); //取得一個和 TWICE 大小一樣的區塊,然後配給 head 這個指標
                 ^~~
prog.c:13:17: note: each undeclared identifier is reported only once for each function it appears in
prog.c:13:21: error: expected ‘,’ or ‘;’ before ‘TWICE’
   TWICE *head = new TWICE(); //取得一個和 TWICE 大小一樣的區塊,然後配給 head 這個指標
                     ^~~~~
prog.c:13:10: warning: unused variable ‘head’ [-Wunused-variable]
   TWICE *head = new TWICE(); //取得一個和 TWICE 大小一樣的區塊,然後配給 head 這個指標
          ^~~~
prog.c:10:14: warning: unused variable ‘i’ [-Wunused-variable]
   int count, i;
              ^
stdout
Standard output is empty