Courses
Tutorials
Practice
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
C++
4.3K+ articles
C Language
2.1K+ articles
Articles
234+ articles
cpp-array
173+ articles
cpp-string
157+ articles
cpp-pointer
93+ articles
c-array
34+ articles
secure-coding
25+ articles
C-programming
9+ articles
gets
2+ articles
C Array and String
17 posts
Recent Articles
Popular Articles
How to Write Your Own printf() in C?
Last Updated: 14 July 2023
In this article, we will learn how to implement your own custom printf() function in C language.The printf() function is present in stdio.h header and uses a const char* a...
read more
C-Output
C Language
C Array and String
How To
What's difference between char s[] and char *s in C?
Last Updated: 10 January 2025
Consider below two statements in C. What is the difference between the two? char s[] = "geeksquiz"; char *s = "geeksquiz";Below are the key differences: The statement...
read more
cpp-string
C Language
Difference Between
C Array and String
Variable Length Arrays (VLAs) in C
Last Updated: 10 January 2025
In C, variable length arrays (VLAs) are also known as runtime-sized or variable-sized arrays. The size of such arrays is defined at run-time.Variably modified types includ...
read more
cpp-array
C Language
C++
C Array and String
What are the data types for which it is not possible to create an array?
Last Updated: 18 December 2024
In C, an array is a collection of variables of the same data type, stored in contiguous memory locations. Arrays can store data of primitive types like integers, character...
read more
cpp-data-types
cpp-array
C Language
C Array and String
How to write long strings in Multi-lines C/C++?
Last Updated: 06 July 2023
Image a situation where we want to use or print a long long string in C or C++, how to do this? In C/C++, we can break a string at any point in the middle using two doubl...
read more
cpp-string
C Language
C++
C Array and String
How to pass a 2D array as a parameter in C?
Last Updated: 04 March 2025
A 2D array is essentially an array of arrays, where each element of the main array holds another array. In this article, we will see how to pass a 2D array to a function.T...
read more
cpp-parameter-passing
cpp-array
cpp-pointer
C Language
C Array and String
How to dynamically allocate a 2D array in C?
Last Updated: 10 January 2025
Following are different ways to create a 2D array on the heap (or dynamically allocate a 2D array).In the following examples, we have considered 'r' as number of rows, 'c'...
read more
cpp-array
cpp-pointer
C Language
C Array and String
Difference between Arrays and Pointers
Last Updated: 07 August 2023
The array and pointers are derived data types that have lots of differences and similarities. In some cases, we can even use pointers in place of an array, and arrays auto...
read more
cpp-array
cpp-pointer
C Language
C Array and String
Initialization of variables sized arrays in C
Last Updated: 28 September 2018
The C99 standard allows variable sized arrays (see this). But, unlike the normal arrays, variable sized arrays cannot be initialized. For example, the following program c...
read more
C Language
C Array and String
Are Array Members Deeply Copied?
Last Updated: 16 April 2025
In C++, we can assign a struct (or class) variable to another variable of same type. All members of one variable are copied to the other variable. But what happens when th...
read more
pointer
C Language
C Array and String
What is the difference between single quoted and double quoted declaration of char array?
Last Updated: 06 January 2025
In C programming, the way we declare and initialize a char array can differ based on whether we want to use a sequence of characters and strings. They are basically same w...
read more
C Language
C Array and String
Initialization of Multidimensional Array in C
Last Updated: 18 December 2024
In C, multidimensional arrays are the arrays that contain more than one dimensions. These arrays are useful when we need to store data in a table or matrix-like structure....
read more
c-array
C Language
C++
C Array and String
Write one line functions for strcat() and strcmp()
Last Updated: 31 July 2018
Recursion can be used to do both tasks in one line. Below are one line implementations for stracat() and strcmp(). [sourcecode language="C"]/* my_strcat(dest, src) copies ...
read more
C Language
C Array and String
Do Not Use sizeof For Array Parameters in C
Last Updated: 01 July 2022
Using sizeof directly to find the size of arrays can result in an error in the code, as array parameters are treated as pointers. Consider the below program.[tabby title="...
read more
C Language
C++
C Array and String
gets() is risky to use!
Last Updated: 30 October 2023
Consider the below program. [GFGTABS] C void read(){ char str[20]; gets(str); printf(%s, str); return;}[/GFGTABS]The code looks simple, it reads stri...
read more
Articles
C-programming
gets
secure-coding
C Language
C Array and String
1
2
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !