Warning: assignment makes integer from pointer without a cast

This is a discussion on Warning: assignment makes integer from pointer without a cast within the C Programming forums, part of the General Programming Boards category; Hi, My compiler alwasy catches the following line but i dont know how to correct it. This line is in ...

  1. #1
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020

    Warning: assignment makes integer from pointer without a cast

    Hi,

    My compiler alwasy catches the following line but i dont know how to correct it. This line is in the race between the hare and turtle i posted earlier. Pls tell me whats wrong and how to fix it. Thnx a lot.

    note: positions is a char array.

    Code:
    positions[ *currentPos_Tortoise ] = "T";

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    If positions is a character array then you should be doing -

    positions[ *currentPos_Tortoise ] = 'T';

    "T" is a two character string, not a character.

  3. #3
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    thnx a lot for that. I made that mistake coz i was used to programming in vb. Sorry, but what do you mean by two characgter string. Do u mean that "" is only used for including a string, not one characters?

    thnx

  4. #4
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    >Do u mean that "" is only used for including a string, not one characters?

    Yes, "T" is {'T','\0'}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory issue
    By t014y in forum C Programming
    Replies: 2
    Last Post: 02-21-2009, 12:37 AM
  2. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 06:55 PM
  3. Looking for constructive criticism
    By wd_kendrick in forum C Programming
    Replies: 16
    Last Post: 05-28-2008, 10:42 AM
  4. assignment makes pointer from integer
    By crescen7 in forum C Programming
    Replies: 4
    Last Post: 06-25-2002, 11:08 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM

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