Like Tree2Likes

2nd scanf input problem.

This is a discussion on 2nd scanf input problem. within the C Programming forums, part of the General Programming Boards category; You can make your main function quite a bit shorter. You have an exact copy of the code inside the ...

  1. #16
    Registered User
    Join Date
    Mar 2010
    Posts
    535
    You can make your main function quite a bit shorter. You have an exact copy of the code inside the loop outside the loop, which you can remove if you make sure the loop always runs at least once.

    But before that, make the improvements std10093 suggested in post 9. Your shift function is implictly returning an int because you haven't specified a return type. You don't return anything though, and dangeous nonsense will ensure if you accidentally call shift in a context where the returned value is used.
    coder1 likes this.

  2. #17
    F#ck me Freddy!!
    Join Date
    Sep 2013
    Location
    jaipur
    Posts
    78
    thnx.So after adding void if i call (if function have something to return ) it wil return nothing then?(i ma just asking as to know what void really do).
    And also what is the profit of declaring function before main like std10093 said?(i did that but it does not effected my program).
    Also i dont use return 0 in main function but only this time i had problem with that.so what return 0 actually do and what if i don't use it.(i am a beginner so have a lot of questions )
    thanx again for your reply
    Last edited by coder1; 09-08-2013 at 04:25 AM.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. scanf and int input problem
    By Penage in forum C Programming
    Replies: 5
    Last Post: 04-14-2010, 06:14 AM
  2. input using scanf()
    By kizyle502 in forum C Programming
    Replies: 5
    Last Post: 09-10-2009, 12:56 AM
  3. Input and Scanf
    By DAaaMan64 in forum C Programming
    Replies: 3
    Last Post: 01-14-2009, 05:56 PM
  4. Problem with scanf input
    By ejpjoker in forum C Programming
    Replies: 4
    Last Post: 04-29-2004, 08:28 PM
  5. help with input and scanf
    By kpw in forum C Programming
    Replies: 9
    Last Post: 08-28-2001, 08:21 PM

Tags for this Thread


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