-
-
Save KrzaQ/af69526aeab0b14ec55a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <tchar.h> | |
#include <stdlib.h> | |
#define N 10 // liczba wierszy | |
#define M 10 // liczba kolumn | |
void zerowanie(int** plansza); | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
int** plansza, i; // tworzenie wskaznika do int | |
plansza = (int**)malloc(N * sizeof(int*)); | |
for (i = 0; i < N; ++i) | |
; | |
{ | |
plansza[i] = (int*)malloc(M * sizeof(int)); //tworzenie dynamicznej tablicy o wymiarach N x M | |
} | |
zerowanie(plansza); | |
for (i = 0; i < N; ++i) { | |
free(plansza[i]); | |
} | |
free(plansza); // Zwolnienie pamieci zarezerwowanej dla planszy | |
system("PAUSE"); | |
return 0; | |
} | |
//********************************************************************************************************************* | |
void zerowanie(int** plansza) | |
{ | |
int i, j; | |
for (i = 0; i < N; i++) | |
for (j = 0; j < M; j++) { | |
plansza[i][j] = 0; // zapisywanie zer w tablicy Tutaj wyrzuca mi błąd | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment