Filling an Array : char array string « String « C++






Filling an Array

  
#include <iostream>
using namespace std;
int main(){
    char buffer[80] = {'\0'};
    std::cout << "Enter the string: ";
    std::cin >> buffer;
    std::cout << "Here's the buffer: " << buffer << std::endl;
    return 0;
}
  
    
  








Related examples in the same category

1.Demonstrate the basic null-terminated string functions.
2.Operator pointer
3.Count spaces, punctuation, digits, and letters.
4.Convert char array to upper case
5.Using strcpy() to assign value from one char array to another char array
6.Using strncpy() to assign one char array to another char array
7.Using strcpy and string terminator
8.Using strncpy() and string terminator
9.Get the string length
10.Using strcat() and strncat().
11.Using atoi() function
12.Use strlen() to get the length of a char array buffer