Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

malloc

/*
 *Dynamic memory creation using malloc
 *Language: C
 */

#include<stdio.h>
//To use malloc function in our program
#include<stdlib.h>

int main()
{
    int *ptr;

    //allocating memory for 1 integer
    ptr = malloc(sizeof(int));

    if(ptr != NULL)
           printf("Memory created successfully
");

    return 0;
}
Source by www.log2base2.com #
 
PREVIOUS NEXT
Tagged: #malloc
ADD COMMENT
Topic
Name
5+4 =