gets in C
Learn C - C tutorial - Gets in c - C examples - C programs
C - gets() - Definition and Usage
- In C- Programming gets is similar to scanf statement which is used to scan a line of text from a standard input device.
- The gets () function will be terminated by a newline character.
- The newline character won't be included as part of the string.
- The string may include white space characters.
Sample coding - Gets
C Code - Explanation
- Here we are declaring the character array in the variable name “str”.
- In this statement we are getting the character value using getstring function and the value will be stored in the variable “str”.
- In this print statement we are printing the given string value by calling the variable “str”.
- Here the entered string “welcome to wikitechy” has been shown in the console window.
- And using the printf statement we display the statement “Given String is welcome to wikitechy” .