Course Content

Course Content


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.

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
Apple App Store
598K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
15K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere