fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void newmap(int x, int y , int players) {
  5. char **map = malloc(sizeof(char *) * y);
  6. for (int i = 0; i < x; i++) {
  7. map[i] = malloc(x);
  8. for (int j = 0; j < y; j++) {
  9. if (i == 0 || j == 0 || i == x - 1 || j == y - 1) {
  10. map[i][j] = '*';
  11. printf("*");
  12. }
  13. }
  14. printf("\n");
  15. }
  16. }
  17.  
  18. int main(void) {
  19. newmap(3, 3 , 3);
  20. }
  21.  
  22. //https://pt.stackoverflow.com/q/322134/101
Success #stdin #stdout 0s 4456KB
stdin
Standard input is empty
stdout
***
**
***