Thread: Help With Pointers

  1. #16
    Registered User
    Join Date
    May 2007
    Posts
    8
    Quote Originally Posted by Dave_Sinkula View Post
    Code:
    #include <stdio.h>
    
    int main(void)
    {
       int i, j, mark[] = {7,6,9,4,7,7,5,10,8,6,5};
       for ( i = 0; i < sizeof mark / sizeof *mark; ++i )
       {
          printf("%2d|", i + 1);
          for ( j = 0; j < mark[i]; ++j )
          {
             fputs("  ", stdout);
          }
          puts("*");
       }
       puts("  +----------------------");
       puts("   0 1 2 3 4 5 6 7 8 9 10");
       return 0;
    }
    
    /* my output
     1|              *
     2|            *
     3|                  *
     4|        *
     5|              *
     6|              *
     7|          *
     8|                    *
     9|                *
    10|            *
    11|          *
      +----------------------
       0 1 2 3 4 5 6 7 8 9 10
    */

    hi ,

    How can I do this for the numbers that I'll enter randomly ??

  2. #17
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Let 2 year old topics die!

    Next time start a new topic and link to the old one.

  3. #18
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    This should be interesting ...

    But in the meantime here's a FAQ entry which might help: How do I... (Level 1) > How do I get a number from the user (C)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using pointers to pointers
    By steve1_rm in forum C Programming
    Replies: 18
    Last Post: 05-29-2008, 05:59 AM
  2. function pointers
    By benhaldor in forum C Programming
    Replies: 4
    Last Post: 08-19-2007, 10:56 AM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. Staticly Bound Member Function Pointers
    By Polymorphic OOP in forum C++ Programming
    Replies: 29
    Last Post: 11-28-2002, 01:18 PM