Thread: passing arg 1 of 'strlen' makes pointer from integer without a cast

  1. #16
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by ChoCo View Post
    2. why do you use
    Code:
    while(drink type length > 0);
    to loop?
    This is all logic - all in your mind!
    This is not some difficult concept to understand. This is what you do every day.
    To post a reply, for example, you hit Reply, type the text and hit Submit Reply.
    Difficult? I don't think so.
    This is the same thing. Logic. Steps taken to perform something. You should not have to rely on other to tell you how to do something. You should be able to figure out these kinds of things yourself!
    Use a flowchart - write it down on paper how you would do it. How your "thought process" goes. Then translate to code.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #17
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Quote Originally Posted by MK27 View Post
    fgets() will include a \n in the input string, so the strcmp will never succeed:
    Actually it will succeed just fine. He is using fgets() and sscanf(), so the newline at the end won't matter.
    bit∙hub [bit-huhb] n. A source and destination for information.

  3. #18
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by bithub View Post
    Actually it will succeed just fine. He is using fgets() and sscanf(), so the newline at the end won't matter.
    Whoops! Sorry, I should have been paying closer attention.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. warning: cast to pointer from integer of different size
    By DavidDobson in forum C Programming
    Replies: 6
    Last Post: 12-03-2008, 06:37 PM
  2. Replies: 1
    Last Post: 03-24-2008, 10:16 AM
  3. "assignment makes integer from pointer without a cast"
    By Freez3L in forum C Programming
    Replies: 4
    Last Post: 11-04-2002, 04:26 AM
  4. assignment makes pointer from integer
    By crescen7 in forum C Programming
    Replies: 4
    Last Post: 06-25-2002, 10:08 PM
  5. Replies: 3
    Last Post: 01-14-2002, 12:13 PM