The problem is that I cannot see 0 in an array.
I run my program and see 2D array. But instead of 0 (the first element) I see nothing.
Here is the code:
#include <stdio.h> #include <stdlib.h> int main() { int i; int *Ptr; scanf("%d%d", &M, &N); /* Size of array. */ Ptr = malloc(M*N*sizeof(int)); for (i = 0; i < M * N; i++) /* Filling in. */ { *(Ptr + i) = i; } for (i = 0; i < M * N; i++) /* Displaying. */ { if (i % N == 0) printf("\n"); printf("%2.d ", *(Ptr + i)); } return 0; } What is the problem? Is there any way to fix it?
printfformat string, remove it.