fork download
  1. #include <stdio.h>
  2.  
  3. struct Card {
  4. int number;
  5. char face[];
  6. char suit[];
  7. };
  8.  
  9.  
  10.  
  11. int main(){
  12. Card deck;
  13. deck.number = 5; //for debug
  14. char face[] = "Ace"; //for debug
  15. deck.face[] = "Ace";
  16. deck.suit[] = "Hearts";
  17. printf("s of s\n",deck.face,deck.suit);
  18. return 0;
  19. }
  20.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:15:15: error: expected primary-expression before ‘]’ token
     deck.face[] = "Ace";
               ^
prog.cpp:16:15: error: expected primary-expression before ‘]’ token
     deck.suit[] = "Hearts";
               ^
prog.cpp:17:42: warning: too many arguments for format [-Wformat-extra-args]
     printf("s of s\n",deck.face,deck.suit);
                                          ^
prog.cpp:14:10: warning: unused variable ‘face’ [-Wunused-variable]
     char face[] = "Ace"; //for debug
          ^
stdout
Standard output is empty