Home > other >  The malloc
The malloc

Time:09-27

Malloc memory allocated array short * pfDst=malloc (1000 * 1000), and then an array assignment for (k=0; K<30; K++)
{
The scanf (" % d ", & amp; PfSrc [k]);
Printf (" pfSrc: % d \ n ", pfSrc [k]);
}
When the final arithmetic operations to the array, the segmentation fault is this why ah? Pray god to guide

CodePudding user response:

How operation done? Crossing the line?

CodePudding user response:

What the hell is pfSrc? See only pfDst definition,

CodePudding user response:

The return value judgment, if memory will return an error, so there will be a direct operation was carried out on the error number when address would be the wrong,

CodePudding user response:

What is application context, see only the definition of pfDst, operation to pfSrc do

CodePudding user response:

PfSrc didn't see definition, is not allocated memory, or read-only
  • Related