header file stdlib.h

void * calloc( size_t nmemb, size_t size);

calloc() allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. If nmemb or size is 0, then calloc() returns either NULL, or a unique pointer value that can later be successfully passed to free().


nmemb : Number of elements to allocate.

size : Size of each element.


returns a pointer to the allocated memory, which is suitable for any kind of data type variable. On error, it will return NULL.

#include <stdio.h> 
#include <stdlib.h> 

int main ( int argc, char* argv[])
	int * intArray;
	intArray = (int *)calloc( 10, sizeof(int)); 
	//check to see if memory allocation is success.	
	if( intArray)
		int i = 0;
		for( i = 0; i < 10; i++	)
			intArray[i] = i;
		//free after usage
		free( intArray);


Split string into tokens

posted on 2019-03-17 20:41:48 - C Programming Language Tutorials


zalloc is a third party library

posted on 2018-12-12 20:46:30 - C Programming Language Tutorials


posted on 2017-12-29 22:52:47 - C Programming Language Tutorials

Prompt Examples

ChatGPT Prompt Examples

posted on 2023-06-21 22:37:19 - ChatGPT Tutorials

Use Cases

Chat GPT Key Use Cases

posted on 2023-06-21 21:03:17 - ChatGPT Tutorials

Prompt Frameworks

Prompt Frameworks

posted on 2023-06-21 19:33:06 - ChatGPT Tutorials