There are so many loop iterations you create, these are the main reasons your program crashes or the loop is infinitely closed.
The answer to what you expect to find out is very complicated due to some key notes ---- →
1 .. It depends on the platform on which the program runs. windows, linux or mac. I THINK that the amount of memory is not limited by anything other than physical memory.
Fact → Although physical memory can be expanded with virtual memory, not all platforms have a “virtual memory” function. C has no concept of virtual memory. Malloc allocates continuous memory (i.e. side by side or together in ram).
Thus, it depends on how the platform processes the request. It depends on the implementation of C.
2. The largest number (in bytes) represented by the standard type 'size_t' (declared). This value can and depends on the implementation. Note that this value is not necessarily as large as the available memory of the host platform ( i.e. End> ).
QUES. Are there any restrictions on this? Where should I get this kind of information?
Ans . The argument of Malloc is size_t, and the range of this type is [0, SIZE_MAX], so the maximum you can request is SIZE_MAX, the value varies from implementation to implementation and is defined in.
Note. - Whether the request for SIZE_MAX bytes will be successful depends on factors outside the scope of this group.
source share