Help me in c

Discussion in 'Programming/Scripts' started by Abigail, Nov 7, 2009.

  1. Abigail

    Abigail New Member

    Hi Everyone,
    Can you give me some good Example?
    This Example will print the Hello without using printf.
    It is possible.
    Can you help me?
     
    Last edited: Nov 11, 2009
  2. pinguinito

    pinguinito Member

    C "hello.c"

    #include <stdio.h> /* this is C */

    main()
    {
    printf("Hello, Word!\n");
    return 0;
    }



    // Now in C++.

    #include <iostream>
    int
    main()
    {
    std:: cout<<"!Bienvenido a C++!\n";
    return 0;
    }

    I hope this help Editor "vi" then gcc for C g++ for C++ for compiler
     
  3. vinopavit

    vinopavit New Member

    If u find the answer say me

    I think it is not possible to print without printf statement :eek:
     
  4. bfasula

    bfasula New Member

    #include <stdio.h>
    main()
    {
    putchar('h');
    putchar('e');
    putchar('l');
    putchar('l');
    putchar('o');
    putchar('\n');
    }
    ~
     
  5. skumar93

    skumar93 New Member

    I think putchar function will be helpful..
     
  6. BobGeorge

    BobGeorge Member

    What's wrong with the "printf" function that you don't want to use it?

    Also, more generically, where do you want this to be printed?

    Because, really, "printf" is just "fprintf" where the output stream - the first argument to "fprintf" - is always set to "stdout" every time. With "fprintf" you can print to files, for example. Open a file to get a file descriptor and then you can pass that to "fprintf" to print to the file.

    Even with "stdout" and "stdin", these can be redirected at the command line. If you "cat somefile.txt > anotherfile.txt" then the ">" operator will hook the "stdout" of the "cat" command to the file "anotherfile.txt" and, in effect, the command I just gave is an elaborate copy command. Because "cat" will print the contents of "somefile.txt" to its "stdout" and this has been redirected to "anotherfile.txt", so it'll just print the contents of "somefile.txt" into "anotherfile.txt".

    Basically, the real question is what do you want this for? Just education or do you have a specific programming problem you need to solve?

    The more information you give us, the better an answer we can give you.
     

Share This Page