We don't need to print a string character by character like we do with arrays. Although the C language has an intrinsic data type for strings, it does provide an access specifier called "percent s" that can be used to print and read texts directly.
The string can be printed using the printf function's %s format specifier. It will print the string starting at the provided address and ending at the null '0' character. The string's initial address is the string's name. As a result, if we specify string name, the complete string will be printed.
Print a String in C++
Use std::cout and << Operator to Print a String.
Use std::copy Algorithm to Print a String.
Use printf() Function to Print a String.
To print a character, you must first supply the character's value to printf. The value can be referred to as name[0] or *name (because name = &name[0] for an array). To print a string, supply a pointer to the string (in this case, 'name' or '&name[0]') to printf.
A string in C programming is a sequence of characters that ends with the null symbol 0. char c[] = "c string" for example; By default, the compiler appends a null character 0 to the end of a sequence of characters wrapped in double quotation marks.
Learner's Ratings
4.4
Overall Rating
69%
18%
5%
4%
4%
Reviews
H
Harshad Futane
5
i am studying 7 th standard in semi english school of pimpri
i am founding the best free classes of programing
and i found it the name of class is *LEARNVERN*
and the class is best.
THANK YOU
A
Avinash Kumar
4
The Course is Amazing and content is also amazing bu i want the notes please provide that sir ..
I
Ishant kumar
4
best
K
Krishna dhangar
5
nice,teaching
A
Ashutosh Thakkar
5
It is as same as any college can offer or if you refer any book this as same as that. Great teaching of C language. I am really happy about this course
I
Ishant Kumar
5
i love c language
P
PATAN MASTHAN
5
sir need c notes it is very useful us to read after listening class so i request u do please provide notes......................masthimasthan786@gmail.com this is my mail
L
Lalita
5
this courses are very helpful. thank you so much.
B
Biwek Gorai
5
I like this course , thank you for your free courses, your free course many people for helpful.
Share a personalized message with your friends.