Q:
Write a C Program to understand the use of realloc() function
belongs to collection: C Pointer Solved Programs – C Programming
C Pointer Solved Programs – C Programming
- C Program to Access elements of an array using pointer
- Write a C Program to Swap Two Numbers Using Call by Reference
- C Program to Find Largest Number Using Dynamic Memory Allocation
- Write a C Program to Sort Infinite Numbers in Ascending Order
- Write a C program to Swap two numbers using pointers
- Write a C Program to Reverse each word in string using pointers
- Write a C Program to reverse string using pointers and function
- Write a C Program to find largest number using pointers
- Write a C Program to find sum and average of n numbers using pointers
- C Program to Sort n numbers in ascending order using pointers
- C Program to check string is palindrome or not using pointers
- Write a C Program to Get Address of array using Pointers
- C program to count number of vowels and consonants in a string using pointer
- Write a C program for Student details using pointer and structure
- Write a C program to Print string using pointers
- Write a C program to print size of different data types using pointers
- C program to perform double pointer or Pointer to Pointer
- Write a C program to perform Array of pointers
- Write a C Program to implement Stack Operations Using Pointer
- Write a C Program to Find Length of String using Pointers
- Write a C Program to Reverse array using Pointers
- Write a C Program to display array with addresses using pointers
- Write a C Program for Addition of Two Numbers Using Pointers
- Write a C Program to dereference pointer variables
- Write a C Program to show an example of pointer to pointer
- C Program to print value and address of elements of an array using pointer
- Write a C Program to perform Call By Value and Call By Reference methods
- Write a C Program to return more than one value from a function
- Write a C Program for dynamic memory allocation using malloc( )
- Write a C Program to understand the use of realloc() function
- Write a C Program to understand pointers to structures
- Write a C Program to understand how pointer to structure variable is sent to function
- Write a C Program to understand how pointer to structure returned from function
C realloc()
If the previously allocated memory is insufficient or more than required, you can change the previously allocated memory size using realloc().
Description
The C library function void *realloc(void *ptr, size_t size) attempts to resize the memory block pointed to by ptr that was previously allocated with a call to malloc or calloc.
Syntax of realloc() : :
Parameters
Return Value
This function returns a pointer to the newly allocated memory, or NULL if the request fails.
Below is the source code for C Program to understand the use of realloc() function which is successfully compiled and run on Windows System to produce desired output as shown below :
SOURCE CODE : :
OUTPUT ::
need an explanation for this answer? contact us directly to get an explanation for this answer