Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

C malloc

#include <stdlib.h>
int main(){
int *ptr;
ptr = malloc(15 * sizeof(*ptr)); /* a block of 15 integers */
    if (ptr != NULL) {
      *(ptr + 5) = 480; /* assign 480 to sixth integer */
      printf("Value of the 6th integer is %d",*(ptr + 5));
    }
}
Source by www.guru99.com #
 
PREVIOUS NEXT
Tagged: #C #malloc
ADD COMMENT
Topic
Name
9+3 =