SillyCodes | C
845 FOLLOWERS
Venkatesh Macha is passionate about Computer programming, Real Time Communication, Cyber Security, FOSS, and Blogging. Read the blog to find articles on C programming tutorials and tips for beginners.
SillyCodes | C
1y ago
Introduction:
In earlier posts, we looked at static vs dynamic memory allocation, Memory allocation using the malloc() function and calloc() function. In today’s article, We will look at the Reallocation of dynamically allocated memory using the realloc function in c programming language.
? Index of All C Language Tutorials with Step by step explanation
Prerequisites:
Please go through the following pointers and functions programs to better understand this tutorial.
Pointers in C language with Example Programs.
Pointers and Arrays in C
Size of Pointers in C
The realloc() function in C – R ..read more
SillyCodes | C
1y ago
Introduction:
We have looked at the static vs dynamic memory allocation and malloc() function in earlier articles, In today’s article, We are going to look at the calloc function in c programming language
Must Read:
Pointers in C Language – How to Create and use pointers
Program to demonstrate Address of Operator in C Language (&)
Dereference Operator in C (*) – Indirection operator in C Language
Calloc function in C Language:
The calloc() function is used to allocate multiple chunks of memory dynamically. Here is the syntax of the calloc() function in c language.
Syntax of callo() fu ..read more
SillyCodes | C
1y ago
Introduction:
We have looked at the pointers in c programming in earlier articles. In today’s tutorial, we will look at the dynamic memory allocation using malloc function in c language with example programs.
Prerequisites:
It is recommended to know the pointers in c language. So please go through the following pointers tutorials to better understand this tutorial.
Pointers in C Language – How to Create and use pointers
Pointer Arithmetic in C Language
The malloc() function in C – Allocate Memory Dynamically using Malloc() function:
The malloc() function is used to dynamically allocate memo ..read more
SillyCodes | C
1y ago
Program Description:
We have looked at the Pointer to an Array in earlier articles. In today’s article, We will look at the Array of Pointers in C programming language with example programs.
?Recommended Reading:
Pointers Tutorials
Pointers Practice Programs series
An Array of Pointers in C Programming:
As the name suggests, An array of pointers is an Array where every element of the array is a pointer variable.
Unlike the normal array, All elements of the array of pointers are pointer variables, which are capable to store the address of another variable.
Here is the syntax to create the ..read more
SillyCodes | C
1y ago
Introduction:
In an earlier article, we discussed the relationship between pointers and arrays. In today’s article, We will look at the pointer to array in c programming language.
? Recommended: Pointers Practice Programs series
What is Pointer to Array in C Language:
The C programming language allows us to declare a pointer that points to the entire array. This type of pointer is called Pointer to Array.
In earlier posts, we looked at the pointer to the array which points to the first element of the array.
int files[5];
// Pointer
int *ptr = files;
In the above example, The pointer var ..read more
SillyCodes | C
1y ago
Introduction:
We have covered the C Pointers, Pointer Arithmetic, and Pointer to pointers in earlier articles. In today’s article, We will look at the void pointer in c programming language.
? Recommended: C Practice Programs Collection
Void Pointer in C Programming Language:
A pointer is a special variable, that can store the address of another variable. To declare the pointer variable we usually specify the pointer name with the pointer datatype.
int *ptr;
The data type of the pointer depends on the data the pointer going to point to ( Store the address).
If you want to store the address ..read more
SillyCodes | C
1y ago
Introduction:
In previous articles, we looked at pointers in C and Double pointers in C with example programs. In this article, we will look at function pointers in c programming language with examples.
? Must Check: Pointers Practice Programs series
Function Pointers in C Language:
The function pointers are pointer variables, which are capable to store the memory address of a function.
Function pointers are used to create and use the callbacks and we can also pass a function as an argument to another function using the function pointers in C.
? Function pointers store the memory address of ..read more
SillyCodes | C
1y ago
Function Returning Pointer in C:
Write a Program to demonstrate a function returning pointer in c programming language. As we have discussed earlier in the introduction to pointer and pointers and array articles, We can return a pointer variable from a function in C language. We are going to look at such an example in this article.
? C Practice Program Index
When we want to return multiple values or an array from a function, we can accomplish this by returning the array as a pointer variable.
We need to use a static variable(static array) inside the function so that it will be live througho ..read more
SillyCodes | C
1y ago
Print String Elements using Pointers Program Description:
Write a Program to demonstrate how to print string elements using pointers in c programming language. The program should accept a string from the user and print all string characters using a pointer. To access the string elements, we will use standard pointer notation (by dereferencing the pointer) as well as pointer subscript notation.
Here is the example input and output of the program.
Example Input and Output:
Input:
Enter a string : code
Output:
chPtr[0]:c
chPtr[1]:o
chPtr[2]:d
chPtr[3]:e
Prerequisites of the program:
Please go th ..read more
SillyCodes | C
1y ago
Accessing Array Elements using Pointers in C Program Description:
Write a Program to Access the array elements using pointers in c programming language. The program should accept an array and print array elements using pointers. To access the array’s elements, we will use standard pointer notation (by dereferencing the pointer) as well as pointer subscript notation.
Prerequisites:
It is recommended to know the basics of the C Pointers and C Arrays, So please go through the following tutorials learn more about these concepts.
Pointers in C Programming Language – Declare, Initialize, and use p ..read more