Is it possible to read sentences without using scanf in c programming ??

Morningdot Hablu

Morningdot Hablu

@morningdot-6Xuj4M Oct 26, 2024
Is it possible to read sentences without using scanf in c programming ??

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Leo

    Leo

    @leo-ZJQlmh Aug 7, 2010

    Try using gets(), fgets(), fscanf().
  • vasu07

    vasu07

    @vasu07-MVUbsB Aug 11, 2010

    getchar() is much better option for it.
  • anandkumarjha

    anandkumarjha

    @anandkumarjha-jzdDMA Aug 11, 2010

    hello vasu
    as far as i know there is a difference between gets() and getchar()
    gets() reads character fromstdin and stores them as the string into struntil a newline character(\n) or the end of the file is reached ,but getchar() Returns the next character from the standard input (stdin).
    It is equivalent to getc with stdin as its argument.
    if i am wrong please let me know
  • kamal_kj5

    kamal_kj5

    @kamal-kj5-113qTh Aug 12, 2010

    Mr.AnandKumar,U r right.But does that make any difference about his post?The only issue here is to read sentences without using a scanf and his response satisfies that. getchar(),gets(),fscanf() can be used for such kinda programming.If not satisfied,you can try to create your own library file(header files may also be referred so) to get the result you expect.
  • HImanshu_Sharma

    HImanshu_Sharma

    @himanshu-sharma-HOM7Hg Aug 12, 2010

    you are right buddy