Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

malloc in c

// Let's allocate enough space on the heap for an array storing 4 ints

intArray = (int *) malloc(4 * sizeof(int)); // A pointer to an array of ints

intArray[0] = 10;
intArray[1] = 20;
intArray[2] = 25;
intArray[3] = 35;
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #malloc
ADD COMMENT
Topic
Name
4+7 =