C++ Program to Read String using gets Function

C++ Program to Read String using gets Function

Write C++ Program to Read String using gets Function

// CPP Program to Read String using gets Function

//it differs from the scanf as in scanf after the space the string ends with the null character
// here null character is applied only after the size is over and space is also considered as a character

#include <iostream>

using namespace std;

int main()
{
	char S[50];
	cout << "Enter the String :--> ";

	gets(S);

	cout << "You Entered :--> " << S;
	return 0;
}

Output:

Enter the String :--> Code Crucks
You Entered :--> Code Crucks