Like Tree4Likes

short matrix problem

This is a discussion on short matrix problem within the C Programming forums, part of the General Programming Boards category; I don't suppose you've read the manual page for scanf in all your fumbling around. man page scanf section 3 ...

  1. #76
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,485
    I don't suppose you've read the manual page for scanf in all your fumbling around.

    man page scanf section 3
    RETURN VALUES

    These functions return the number of input items assigned. This can be
    fewer than provided for, or even zero, in the event of a matching fail-
    ure. Zero indicates that, although there was input available, no conver-
    sions were assigned; typically this is due to an invalid input character,
    such as an alphabetic character for a `%d' conversion. The value EOF is
    returned if an input failure occurs before any conversion such as an end-
    of-file occurs. If an error or end-of-file occurs after conversion has
    begun, the number of conversions which were successfully completed is
    returned.
    So, begin with
    int result = scanf("%d",&matrix[c][d]);
    printf("scanf returned %d\n", result );

    And observe what you get when you
    - type in a number
    - type in a letter
    - type in your platform specific key sequence (ctrl-d or ctrl-z) to signal EOF
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  2. #77
    Registered User
    Join Date
    May 2012
    Posts
    210
    I just wanted to say thank you to everyone here
    i finished my project and honestly i would've bin lost without u guys
    thank you for taking out the time to help me

Page 6 of 6 FirstFirst 123456
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 10-01-2012, 10:57 PM
  2. How come short + int = int but short + uint = long?
    By y99q in forum C# Programming
    Replies: 2
    Last Post: 10-29-2011, 11:16 AM
  3. Please help! short while loop tracking problem.
    By matthayzon89 in forum C Programming
    Replies: 7
    Last Post: 04-22-2010, 12:29 PM
  4. Replies: 2
    Last Post: 04-21-2008, 07:43 PM
  5. Replies: 7
    Last Post: 02-08-2008, 05:31 PM

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