by Dinesh Thakur

This is C program here user will find out the length of line (string) for this user declare the variables that contain value for it and string functions for string execution. Declaring a variable with array parameter user ask to enter the line as required in quoted area. After that user put the method about string functions along with it display the result as output as result.

Problem Statement:

This is C program that ask user to scan through fgets.

  1. Declare variables.
  2. Using string functions.
  3. Display result on the screen as output.

Here is C source code to scan through fgets. The output of this program shown below. 

#include <string.h>
#include <stdio.h>
char line[100]; /* Line we are looking at */
int main()
{
    printf("Enter a line: ");
    fgets(line, sizeof(line), stdin);
    printf("The length of the line is: %d\n", strlen(line));
    return (0);
}

Scan Through fgets