C Online Compiler
Example: C program to using fgets() function to read complete string with spaces
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C program to using fgets() function to read complete string with spaces #include <stdio.h> #define MAX 1024 // fgets() function will be read maximum 1024 characters int main() { char p[MAX]; printf("Enter a string::\n"); fgets(p, MAX, stdin); // Output printf("\nThe input string is:\n%s\n", p); return 0; }
hello program
Output
Clear
ADVERTISEMENTS