is this array possible?

This is a discussion on is this array possible? within the C++ Programming forums, part of the General Programming Boards category; Code: printf("\n\n\t\t1st Player:"); scan("CLAN[%d]",&CLAN[10]); or Code: printf("\n\n\t\t1st Player:"); scan("%d",&CLAN[10]);...

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    34

    is this array possible?

    Code:
    printf("\n\n\t\t1st Player:");
    scan("CLAN[%d]",&CLAN[10]);
    or

    Code:
    printf("\n\n\t\t1st Player:");
    scan("%d",&CLAN[10]);

  2. #2
    Registered User
    Join Date
    Jan 2005
    Location
    Estonia
    Posts
    131
    Quote Originally Posted by Marrah_janine
    Code:
    printf("\n\n\t\t1st Player:");
    scan("CLAN[%d]",&CLAN[10]);
    or

    Code:
    printf("\n\n\t\t1st Player:");
    scan("%d",&CLAN[10]);
    it has to be scanf not scan

    both are possible

    in the 1st case, there has to be this input from the player:
    CLAN[43]

    where 43 is some kind of a number.
    in the second case, the user has to write
    43
    the same deal with the 43 again

    the stuff that you write in the "" is the form of data that the scanf function has to read - if you try to do memory allocation in it or anything else, it won't work, because scanf doesn't care about it - it only cares about the %d and %f and so on...

  3. #3
    Registered User
    Join Date
    Jan 2005
    Location
    Estonia
    Posts
    131
    and this is a C++ programming board. Your current code is in C, so please don't post in the wrong subforum again

  4. #4
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,424
    CLAN should be an array with at least 11 elements
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 05-29-2009, 07:25 PM
  2. Replies: 6
    Last Post: 11-09-2006, 02:28 AM
  3. [question]Analyzing data in a two-dimensional array
    By burbose in forum C Programming
    Replies: 2
    Last Post: 06-13-2005, 07:31 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM

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