something wrong with my source code?

This is a discussion on something wrong with my source code? within the C Programming forums, part of the General Programming Boards category; #include <stdio.h> void main() { char *message[2]={"Four", "helo"}; int count, i; for(count=0; count<2; count++) { for(i=0; i<4; i++) printf("%s\n", message[count][i]); ...

  1. #1
    Unregistered
    Guest

    Smile something wrong with my source code?

    #include <stdio.h>

    void main()
    {
    char *message[2]={"Four", "helo"};
    int count, i;

    for(count=0; count<2; count++)
    {
    for(i=0; i<4; i++)
    printf("%s\n", message[count][i]);
    }
    }

    Question:
    I would like to print the letters one by one( i.e f, o, u, r and h, e, l, o ) in multi-dimensional array but the compiler gave me an error once I compiled it.

    Someone please rectify my errors.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    25
    here is your problem...

    >> printf("%s\n", message[count][i]);

    do it this way,

    printf("%c\n", message[count][i]);
    Java ROCKZZZZ....
    java.sun.com

    Write once, run everywhere!!!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to make a program that prints it's own source code???
    By chottachatri in forum C++ Programming
    Replies: 38
    Last Post: 03-28-2008, 07:06 PM
  2. Replies: 4
    Last Post: 01-18-2008, 06:05 PM
  3. Documenting Source Code
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 01-04-2008, 11:18 AM
  4. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 03:17 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21