Thread: C passing an array of struct to delete one problems (from a newbie)

  1. #31
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by bithub View Post
    It works if the user's name is less than 20 characters and doesn't contain any spaces (Eddie Van Halen would not approve!).
    It was only an example to point him in the right direction...

    Quote Originally Posted by whiteflags View Post
    I just want to point out that the only reason assignment does not work with C strings is because C strings are a particular kind of array.
    The big reason it doesn't work is the total lack of compiler support for strings.

    You can't assign a C string because you can't assign arrays.
    I know we can't... but we should be able to.


    Now I know the tradition and I get how to work with the library to get results... but really, the second generation C compiler, way back in the 70s should have fixed this obvious and glaring omission... but here we are nearly half a century later, still messing with arrays and pointers.

    I started out in procedural Pascal which was essentially C with strings... I still miss it.
    Last edited by CommonTater; 03-30-2011 at 11:50 AM.

  2. #32
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,611
    I know we can't... but we should be able to.
    I think it's more than just tradition that stops this from happening. C programs never kept track of the size of arrays by themselves: if they did we could do what you want. And if you're going to standardize C's run time requirements that much, you should add a host of other things to it. You could do that now but it wouldn't be backwards compatible with older standards. Whether that's a good thing or a bad thing is something more important people have an opinion on. C's use case throughout its history is the reason it didn't change to be more like other languages that are about as old, like lisp, I think. I'm not exactly a purist, because I do know and use languages with useful run time environments, but we're not exactly "in charge" of the C language.

  3. #33
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by whiteflags View Post
    I'm not exactly a purist, because I do know and use languages with useful run time environments, but we're not exactly "in charge" of the C language.
    Now ain't that the truth!

    If we could do "C with Strings" we'd have to rename it as a new language... C$$ ??

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with delete - Binary search tree
    By lazyme in forum C Programming
    Replies: 10
    Last Post: 03-21-2010, 12:19 PM
  2. Struct Char Array Problems
    By RMDan in forum C Programming
    Replies: 5
    Last Post: 06-18-2009, 07:16 PM
  3. Replies: 1
    Last Post: 12-03-2008, 03:10 AM
  4. Help with an Array
    By omalleys in forum C Programming
    Replies: 1
    Last Post: 07-01-2002, 08:31 AM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM

Tags for this Thread