Results 1 to 5 of 5

Thread: Custom array item names Like PHP (array[item]) but in C

  1. #1

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193

    Custom array item names Like PHP (array[item]) but in C

    in php you can make an array item like this $bob["hello"] instead of having to use $bob[0] is this possible in classic ansi C ?


    thanks for ya help people

  2. #2
    Fanatic Member riis's Avatar
    Join Date
    Nov 2001
    Posts
    551
    Nope, it's not possible.



    (In case you're still interested, you can use the Map template class from the Standard Template Library to achieve the same effect.)

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    (But only in C++. In C, you have to use a procedural implementation of a map, if you can find one. Oh, and the STL map is called map, not Map.)
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193
    K thanks people just wanted to know cos im working on converting this to c from php

    will just have to change my approach

    thanks again

    senorbadger
    Attached Files Attached Files

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    You could use C++...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width