fork download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. void wczyt(int **tab,int a,int b);
  5. int main()
  6. {
  7. srand(time(NULL));
  8. int a,b;
  9. int **tab;
  10.  
  11. printf("Podaj liczby a i b:");
  12. scanf("%d %d",&a,&b);
  13.  
  14. tab=new int *[a];
  15. for(int j=0;j<a;j++) //zapisuje NULL do wzkaznikow
  16. {
  17. tab[j]=NULL;
  18. }
  19. for(int x=0;x<a;x++) //sprawdzam czy sa one nulem wszystkie
  20. {
  21. if(tab[x]!=NULL)
  22. printf("Komorka %d nie jest Nulem\n",x);
  23. else
  24. {
  25. printf("%d OK\n",x);
  26. }
  27.  
  28. }
  29. for(int i=0;i<b;i++)
  30. {
  31. tab[i]=new int[b];
  32.  
  33. }
  34.  
  35. wczyt(tab,a,b);
  36.  
  37. wypisz(tab,a,b);
  38.  
  39. sprawdz_wiersz(tab,a,b);
  40.  
  41. //elem(tab,a,b);
  42. system("pause");
  43. return 0;
  44. }
  45. void wczyt(int **tab,int a,int b)
  46. {
  47. int i,j,e=0;
  48. printf("Wczytywanie liczb!\n");
  49. for(i=0;i<a;i++)
  50. {
  51. for(j=0;j<b;j++)
  52. {
  53. e=rand()%2;
  54. tab[i][j]=e;
  55. e=0;
  56. }
  57. }
  58.  
  59. }
  60.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
10
10
compilation info
prog.c: In function ‘main’:
prog.c:7: warning: implicit declaration of function ‘time’
prog.c:14: error: ‘new’ undeclared (first use in this function)
prog.c:14: error: (Each undeclared identifier is reported only once
prog.c:14: error: for each function it appears in.)
prog.c:14: error: expected ‘;’ before ‘int’
prog.c:15: error: ‘for’ loop initial declaration used outside C99 mode
prog.c:19: error: ‘for’ loop initial declaration used outside C99 mode
prog.c:29: error: ‘for’ loop initial declaration used outside C99 mode
prog.c:31: error: expected ‘;’ before ‘int’
prog.c:37: warning: implicit declaration of function ‘wypisz’
prog.c:39: warning: implicit declaration of function ‘sprawdz_wiersz’
prog.c:12: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
prog.c:42: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result
stdout
Standard output is empty