Difference between structure and union in c programming language

Difference between C structure and union

Difference between structure and union in c Structure Structure is a user defined datatype, programmer can pack up one or more variables of other datatypes into a single element. struct keyword is used to define a structure. Memory is allocated to all structure members. Dot ( . ) operator is used to access a structure … Read more

strncpy in c

What is strncpy in c programming? strncpy function copies n characters from source to destination. This function is defined in string.h header file. This function returns a copied string. Prototype Parameters strncpy function takes source string, destination pointer and size value as input parameters. Return value strncpy function returns a copied string. Example program for … Read more

Dynamic memory allocation techniques in c using malloc(), calloc(), free() and realloc()

What is dynamic memory allocation? Dynamic memory allocation is a method of allocating memory during run time. In dynamic memory allocation memory space can be created, modified, freed. Dynamic memory is allocated on heap. In c programming dynamic memory allocation and deallocation can be done using these 4 functions defined on stdlib.h header file. malloc() … Read more