Thread: wierd error/warning

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    28

    wierd error/warning

    >> warningassing arg 1 of `strtok' makes pointer from integer without a cast


    what does this mean

  2. #2
    Registered User carrotcake1029's Avatar
    Join Date
    Apr 2008
    Posts
    404
    Post some code because apparently it doesn't like the type of data you are supplying as an argument.

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    28
    Code:
     char Puzzle()
      {
            char clues[46][60] = {"BEFORE AND AFTER % WHITNEY HOUSTON TEXAS", "BEFORE AND AFTER % FAIR AND SQUARE DANCE", "FOOD AND DRINK % WHITE CHOCOLATE MOUS$
          gets(clues[Rand_NUM(0,45)]);
       
      }
    ////////////////////////////////////
    //Printing the puzzle&phrase///////////////
    ////////////////////////////////////
    char print_puzzle()
    {
    
                      char *ptr;
                      char ph_clue;
            ph_clue= Puzzle();
                      ptr = strtok(ph_clue,"%");
                              printf("Phrase:%s\n\n",ptr);
            if (ptr!= NULL)
            {
                    ptr = strtok(NULL,",");
                      printf("Puzzle:%s\n\n",ptr);
            }
    
    
          
         }

  4. #4
    Registered User
    Join Date
    Feb 2008
    Posts
    28
    im trying to call a function within a function

  5. #5
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    strtok wants a string (char*) - you give just char

    Puzzle()
    does not have a return
    gets - should not be used - read FAQ
    you are using it incorrectly anyway - read FAQ how to get string from user
    and do not return pointer to local var (if you ever plan to do it)
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  6. #6
    Registered User
    Join Date
    Feb 2008
    Posts
    28
    i knew i had to return something but im not sure what it should be.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Wierd **** - Order of Drawing Stuff?
    By Tonto in forum Game Programming
    Replies: 9
    Last Post: 11-09-2006, 09:56 PM
  2. Wierd chars...
    By mikahell in forum C++ Programming
    Replies: 8
    Last Post: 08-06-2006, 07:18 PM
  3. make user press enter / wierd code thingy
    By CorvusVita in forum C++ Programming
    Replies: 10
    Last Post: 04-05-2006, 09:55 AM
  4. wierd errors
    By DeepFyre in forum C++ Programming
    Replies: 7
    Last Post: 12-21-2004, 09:32 PM
  5. This is wierd.
    By Ranedhel in forum C++ Programming
    Replies: 6
    Last Post: 12-12-2003, 03:26 PM