Right Click to Search

Thursday, January 14, 2025

Gets >> Accept / Read String from user


gets : Reading or Accepting String From User in C

Syntax for Accepting String :
  • gets(variable name)

Example :
  1. gets(name);
  2. gets(city)

Live Example :
#include<stdio.h>
void main()
{
char name[20];
printf("\nEnter the Name : ");
gets(name);
}

Rules / Facts : 
  1. %s is not Required
  2. Spaces are also counted in String ( Space Allowed )
  3. String Acceptance Terminated When 'Enter/New Line' Encountered

Bookmark & Share

Tags / Keywords : | , ,

Stumble
Delicious
Technorati
Twitter
Facebook

0 Comments:

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

 

Learn C Programming Copyright © 2010 LKart Theme is Designed by Lasantha, Free Blogger Templates