In this tutorial, we will discuss the concept of Read and print string of one dim array in C
In this topic, we are going to learn how to read and print elements of a one dimensional array in C programming language using loops.
In this blog, We have already discuss that “What is an array“, type of arrays and how to access it
Arrays are the special type of variables to store Multiple type of values(int, string,char, etc)under the same name in the continuous memory location. we can be easily accessed using the indices(indexes)
Here,
In this program, we are briefing input strings of an array and then print them using Printf() scanf() function
Program 1
#include <stdio.h> #include <stdlib.h> int main() { char str[20]; printf("Enter your name\n"); scanf("%s",str); printf("\nCheck your name\n"); printf("%s",str); getch(); return 0; }
When the above code is executed, it produces the following result
Enter your name Vannan Check your name Vannan
In this program, we are briefing input two strings of an array and then print them using Printf() scanf() function using two arrays in C language
Program 2
#include <stdio.h> #include <stdlib.h> int main() { char str[20],str1[25]; printf("Enter your first name\n"); scanf("%s",str); printf("Enter your last name\n"); scanf("%s",str1); printf("\nCheck your full name\n"); printf("%s %s",str,str1); getch(); return 0; }
When the above code is executed, it produces the following result
Enter your first name Vannan Enter your last name Satha Check your full name Vannan Satha
we are briefing input strings of an array and then print them using gets() puts() function
Program 1
#include <stdio.h> #include <stdlib.h> int main() { char str[20]; printf("Enter any sentence\n"); gets(str); printf("\nYou have entered: \n"); puts(str); getch(); return 0; }
When the above code is executed, it produces the following result
Enter any sentence Hello how are you You have entered Hello how are you
Similar post
Code to read and print integers of an array in Java
Code to read and print strings of an array in Java
Code to read and print characters of an array in Java
Code to read and print integers of an array in C++
Code to read and print strings of an array in C++
Code to read and print characters of an array in C++
Code to read and print integers of an array in C
Code to read and print strings of an array in C
Suggested for you
One dimensional array in C language
One dimensional array in C++ language
Two dimension array in Java language
Two dimension array in C language
Two dimension array in C++ language
Three dimension array in Java language
Three dimension array in C language
Three dimension array in C++ language
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
C# Full Pyramid star pattern program In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…
Java program to check odd or even using recursion In this tutorial, we discuss a…