Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8575169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:38:02+00:00 2026-06-11T19:38:02+00:00

I will have to take the input from user and find the longest input

  • 0

I will have to take the input from user and find the longest input from those 10 strings..

#include<stdio.h>
#include<conio.h>

void main() {
char str[10][10]
printf("Enter strings:")
scanf("%s", str)

}

If I take the user input like this, would it store the strings in str two dimensional array? To find out the longest string first I would find the length of each strings and use max_length function to determine the longest string.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:38:03+00:00Added an answer on June 11, 2026 at 7:38 pm

    You do not need to store all of the strings, just the longest one entered so far.
    Note that you do need to define a maximum length of string to avoid buffer overrun.

    For example:

    #define MAX_STRING_SIZE 1024
    
    char last_entered_string[MAX_STRING_SIZE];
    char longest_entered_string[MAX_STRING_SIZE] = ""; /* Must be initialized. */
    
    scanf("%1023s", last_entered_string); /* Read one less to allow for
                                             null terminator. */
    

    Use a loop to accept the ten inputs and compare with the longest string. If the last entered string is longer then copy it into the longest string. As this is homework I’ll not provide any further code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program below that tries to take input from the user and
Its about a small android application that will take hours as input from user
I have made a program that gets some strings in input from the user
Background I have a web app that will create an image from user input.
Does anyone have some code that will take a TimeZoneInfo field from .NET and
I have to multiply digits by taking input from the user and when he
So I have some code here that takes user input from a standard web
Suppose i have array of characters. say char x[100] Now, i take input from
I have a java application that will take the image as an input and
I have a window-based project with two UITextField s to take input from the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.