what is full defination of getch , getchar , getche ,printf ,scanf,getchar, in c

  1. vinay sharma  ji profile image59
    vinay sharma jiposted 13 years ago

    what is full defination of getch , getchar , getche ,printf ,scanf,getchar, in c language

  2. johnsams profile image68
    johnsamsposted 13 years ago

    getch() returns the character you typed without displaying it on the screen.

    getchar() works similarly and displays the character that you typed on the screen after "enter" is given.

    getche() returns the character you typed by displaying(echoing) it on the screen.

    The printf function prints output to stdout, according to format and other arguments passed to printf. The string format consists of two types of items: characters that will be printed to the screen, and format commands that define how the other arguments to printf are displayed.

    In simple words printf function prints formatted output to a file.

    scanf() function reads input from stdin, according to the given format, and stores the data in the other arguments. It works a lot like printf().

  3. parmindermaan profile image54
    parmindermaanposted 12 years ago

    1) getchar () function reads a single character from standard input. It takes no parameters and its returned value is the input character. In general, a reference to the getchar function is written as character
    variable = getchar();
    For example char c;
    c= getchar () ;
    The second line causes a single character to be entered from the standard input device and then assigned to c.If an end-of-file condition is encountered when reading a character with the getchar function, the value of the symbolic constant EOF will automatically be returned. This function can also be used to read multicharacter strings, by reading one character at a time within a multipass loop.

    2) The getch() Function
    The getch() function obtains the next character from the stream stdin. It provides unbuffered character input without echo. The getch() function isn”t part of the ANSI standard. This means that it might not be available on every system. Additionally, it might require that different header files be included. Generally, the prototype for getch() is in the header file CONIO.H, as follows:
    int getch(void);

    Because it is unbuffered, getch() returns each character as soon as the key is pressed, without waiting for the user to press Enter. Because getch() doesn’t echo its input, the characters aren”t displayed on-screen. The following function uses getch(), which is not ANSI-compliant. There is no guarantee that all compilers support non-ANSI functions.

    3)scanf():-Input data can be entered into the computer from a standard input device by means of C library function scanf. This function can be used to enter any combination of numerical values, characters single character and strings. The function returns the number of data items that have been entered successfully.
    In general terms, the scanf function is written as
    scanf (string, parameter 1, parameter 2…, parameter n);

    Where string= string containing certain required formatting information, and Parameter 1, parameter 2.. = parameters that represent the individual input data item. The control string or string comprises individual groups of characters, with one character group for each input data item. Each character
    group must start with percent sign (%). In the string, multiple character groups can be contiguous, or separated by white space characters. The conversion character that is used with % sign are many in number and all have different meaning corresponding to type of data item that is to be input from keyboard.

    4)printf():-A printf() format string specifies how the output is formatted. Here are the three possible components of a format string:
    •    Literal text is displayed exactly as entered in the format string. In the preceding example, the characters starting with the T (in The) and up to, but not including, the % comprise a literal string.
    •    An escape sequence provides special formatting control. An escape sequence consists of a backslash (\) followed by a single character. In the preceding example, \n is an escape sequence. It is called the new line character, and it means "move to the start of the next line." Escape sequences are also used to print certain characters
    •    A conversion specifier consists of the percent sign (%) followed by a single character. In the example, the conversion specifier is %d. A conversion specifier tells printf() how to interpret the variable(s) being printed. The %d tells printf() to interpret the variable x as a signed decimal integer


This website uses cookies

As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://corp.maven.io/privacy-policy

Show Details
HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
LoginThis is necessary to sign in to the HubPages Service.
Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
AkismetThis is used to detect comment spam. (Privacy Policy)
HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
MavenThis supports the Maven widget and search functionality. (Privacy Policy)
Google AdSenseThis is an ad network. (Privacy Policy)
Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
Index ExchangeThis is an ad network. (Privacy Policy)
SovrnThis is an ad network. (Privacy Policy)
Facebook AdsThis is an ad network. (Privacy Policy)
Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
AppNexusThis is an ad network. (Privacy Policy)
OpenxThis is an ad network. (Privacy Policy)
Rubicon ProjectThis is an ad network. (Privacy Policy)
TripleLiftThis is an ad network. (Privacy Policy)
Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)
ClickscoThis is a data management platform studying reader behavior (Privacy Policy)