String Problem?

Discussion in 'C Programming' started by Davy, Oct 7, 2005.

  1. Davy

    Davy Guest

    Hi all,

    I found
    char x[4]={"my"};
    can be compiled.

    But
    char x[4];
    x={"my"};
    can not be compiled.

    Why?
    Any suggestions will be appreciated!

    Best regards,
    Davy
    Davy, Oct 7, 2005
    #1
    1. Advertising

  2. In article <>,
    Davy <> wrote:
    >I found
    > char x[4]={"my"};
    >can be compiled.


    >But
    > char x[4];
    > x={"my"};
    >can not be compiled.


    >Why?


    Because that's how it is.

    Initializers on a variable declaration have syntaxes available
    that are not available in other places.
    --
    Camera manufacturers have temporarily delayed introduction of
    sub-millibarn resolution bio-hyperdimensional plasmatic space polyimaging,
    but indications are that is still just around the corner.
    Walter Roberson, Oct 7, 2005
    #2
    1. Advertising

  3. Davy

    sat Guest

    Ok davy, to understand this,
    you need some background on the way C / C++ deals with array names and array
    pointers.

    char* p1 = "hello";
    char p2[] = hello;

    now.. p1 and p2 can be used in most places interchangeable.. like
    1. p1[0];
    2. *(p2+2)
    etc etc..
    but there are few exceptioins for this.
    1. p2++
    2. p2 - =10;
    3. p2 = p1
    4. char* ch = "world" ;
    p2 = ch;
    ARE NOT VALID

    the thumb rule is "you cant do any modication operations to the address
    pointed by the array name". You will get an LValue required error.




    "Davy" <> wrote in message
    news:...
    > Hi all,
    >
    > I found
    > char x[4]={"my"};
    > can be compiled.
    >
    > But
    > char x[4];
    > x={"my"};
    > can not be compiled.
    >
    > Why?
    > Any suggestions will be appreciated!
    >
    > Best regards,
    > Davy
    >
    sat, Oct 7, 2005
    #3
  4. Davy

    Kid Hugh Guest

    You can use the following:
    strcpy(x,"my");
    instead of
    x={"my"};

    x is an array pointer not only a variable.

    "Davy" <> ????
    news:...
    > Hi all,
    >
    > I found
    > char x[4]={"my"};
    > can be compiled.
    >
    > But
    > char x[4];
    > x={"my"};
    > can not be compiled.
    >
    > Why?
    > Any suggestions will be appreciated!
    >
    > Best regards,
    > Davy
    >
    Kid Hugh, Oct 7, 2005
    #4
  5. Davy

    werasm Guest

    Davy wrote:
    > Hi all,
    >
    > I found
    > char x[4]={"my"};
    > can be compiled.


    Yes, but it is better to do this:

    char x[] = "my";

    This way just enough space for "my" is provided.

    > But
    > char x[4];
    > x={"my"};
    > can not be compiled.


    Because the type of x in...

    char x[4];

    ....is effectively...

    char* const x;

    ....which means the value of the pointer "x" is constant - may not be
    modified, whereas doing this...

    x={"my"}; //- actually x = "my"...

    ....attemps to modify the pointer x, which is why you get a compiler
    error.

    Suggestions as follow:

    char x[100] = { '\0' };
    std::eek:strstream os( x, sizeof(x) );
    os << "Hooh, hah" << std::ends; //don't forget std::ends;

    or...

    std::string x("my");

    or...

    char x[4] = { '\0' };
    strcpy( x, "my" );

    Remember, the contents of the array which exists at the address
    location whereto x points, is modifiable. The address itself (or the
    value of the ptr) is not.

    Regards,

    W


    >
    > Why?
    > Any suggestions will be appreciated!
    >
    > Best regards,
    > Davy
    werasm, Oct 7, 2005
    #5
  6. Davy

    Dale Guest

    "Davy" <> wrote in news:1128661915.425811.133260
    @g44g2000cwa.googlegroups.com:
    >
    > Hi all,
    >
    > I found
    > char x[4]={"my"};
    > can be compiled.
    >
    > But
    > char x[4];
    > x={"my"};
    > can not be compiled.
    >
    > Why?


    Remember. sweetums, 'x' is a pointer when you declare it that way. If that
    assignment actually worked, it would be changing the pointer itself, not
    the data that the pointer points to.

    Be glad it didn't compile, because the resulting program would have either
    crashed or produced bizarre results, and then you'd be sitting there all
    day trying to figure out why.
    Dale, Oct 7, 2005
    #6
  7. On 07 Oct 2005 17:53:50 GMT, in comp.lang.c , Dale <>
    wrote:
    >"Davy" <> wrote in news:1128661915.425811.133260
    >@g44g2000cwa.googlegroups.com:
    >>
    >> char x[4]={"my"};

    >
    >Remember. sweetums, 'x' is a pointer when you declare it that way.


    Actually, no, this is terribly terribly wrong. In neither declaration
    is 'x' a pointer - its an array[4] of char.

    >If that assignment actually worked, it would be changing the pointer itself, not
    >the data that the pointer points to.


    Which would be perfectly legal for a pointer. However for an array,
    you simply can't do that.
    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
    Mark McIntyre, Oct 8, 2005
    #7
  8. Davy

    Dale Guest

    Mark McIntyre <> wrote in
    news::

    > On 07 Oct 2005 17:53:50 GMT, in comp.lang.c , Dale <>
    > wrote:
    >>"Davy" <> wrote in news:1128661915.425811.133260
    >>@g44g2000cwa.googlegroups.com:
    >>>
    >>> char x[4]={"my"};

    >>
    >>Remember. sweetums, 'x' is a pointer when you declare it that way.

    >
    > Actually, no, this is terribly terribly wrong. In neither declaration
    > is 'x' a pointer - its an array[4] of char.


    You're the one who's wrong, here, fucknut -- 'x' is a character pointer
    when you declare it that way. That's how C stores an array in memory;
    i.e., as a pointer to a chunk of RAM.

    Run this little program and observe the output:

    int main(void)
    {

    char x[4]={"my"};

    printf("%c\n", x);
    printf("%c\n", *x);

    return 0;
    }

    The first printf() will display garbage (because it's actually printing
    the value of a pointer) but the second will display the letter 'm'
    (because it's printing the value that the pointer points to). If 'x'
    were not a pointer then this wouldn't even fucking compile because '*x'
    would be considered invalid indirection.

    Dumbass.
    Dale, Oct 8, 2005
    #8
  9. Dale wrote:
    > Mark McIntyre <> wrote in
    > news::
    >
    >
    >>On 07 Oct 2005 17:53:50 GMT, in comp.lang.c , Dale <>
    >>wrote:
    >>
    >>>"Davy" <> wrote in news:1128661915.425811.133260
    >>>@g44g2000cwa.googlegroups.com:
    >>>
    >>>> char x[4]={"my"};
    >>>
    >>>Remember. sweetums, 'x' is a pointer when you declare it that way.

    >>
    >>Actually, no, this is terribly terribly wrong. In neither declaration
    >>is 'x' a pointer - its an array[4] of char.

    >
    >
    > You're the one who's wrong, here, fucknut -- 'x' is a character pointer


    No x is an array

    > when you declare it that way. That's how C stores an array in memory;
    > i.e., as a pointer to a chunk of RAM.


    That is just confused. Arrays are stored as 'a chunk of RAM', pointers
    don't enter the picture.

    >
    > Run this little program and observe the output:
    >
    > int main(void)
    > {
    >
    > char x[4]={"my"};
    >
    > printf("%c\n", x);
    > printf("%c\n", *x);
    >
    > return 0;
    > }
    >
    > The first printf() will display garbage (because it's actually printing
    > the value of a pointer) but the second will display the letter 'm'
    > (because it's printing the value that the pointer points to). If 'x'
    > were not a pointer then this wouldn't even fucking compile because '*x'
    > would be considered invalid indirection.


    You clearly don't know the rule in C and C++ which allows an array to
    convert to a pointer in many cirumstances. x can convert to a pointer,
    and that is what it is doing in both your examples above, but that does
    not mean that x is a pointer.

    Try this program out

    int main()
    {
    char x[99];
    printf("%u\n", sizeof x);
    }

    It x really was a pointer then that would print 4 (the size of a
    pointer) but it prints 99 (the sizeof the array). That is because sizeof
    is on of the exception to the rule that an array can be converted to a
    pointer. There are other exceptions as well but they are rare, so I can
    see how you might have missed this.

    >
    > Dumbass.


    If you are going to post to a public forum, you have accept the
    possiblity that you might be wrong, and that you might be corrected. It
    stops everyone else thinking you are a wanker if you can accept those
    occaisions with good grace.

    john
    John Harrison, Oct 8, 2005
    #9
  10. Davy

    Kai-Uwe Bux Guest

    Dale wrote:

    > Mark McIntyre <> wrote in
    > news::
    >
    >> On 07 Oct 2005 17:53:50 GMT, in comp.lang.c , Dale <>
    >> wrote:
    >>>"Davy" <> wrote in news:1128661915.425811.133260
    >>>@g44g2000cwa.googlegroups.com:
    >>>>
    >>>> char x[4]={"my"};
    >>>
    >>>Remember. sweetums, 'x' is a pointer when you declare it that way.

    >>
    >> Actually, no, this is terribly terribly wrong. In neither declaration
    >> is 'x' a pointer - its an array[4] of char.

    >
    > You're the one who's wrong, here, fucknut -- 'x' is a character pointer
    > when you declare it that way. That's how C stores an array in memory;
    > i.e., as a pointer to a chunk of RAM.


    I see that you have set the follow-ups to comp.lang.c. However, as your
    original comment was posted in comp.lang.c++, too, be informed that, in the
    context of C++, you are not correct with respect to the type of 'x'.
    Consider:

    #include <iostream>
    #include <iomanip>
    #include <typeinfo>

    template < typename T >
    struct is_array {

    static const bool value = false;

    };

    template < typename T, unsigned long N >
    struct is_array< T[N] > {

    static const bool value = true;

    };

    template < typename T >
    struct is_pointer {

    static const bool value = false;

    };

    template < typename T >
    struct is_pointer< T* > {

    static const bool value = true;

    };


    int main ( void ) {
    char x [4];

    typedef char char_array [4];
    char_array y;

    typedef char* char_pointer;
    char_pointer z;

    std::cout << std::boolalpha << ( typeid(x) == typeid(y) ) << '\n';
    std::cout << std::boolalpha << is_array<char_array>::value << '\n';
    std::cout << std::boolalpha << is_pointer<char_array>::value << '\n';
    std::cout << '\n';
    std::cout << std::boolalpha << ( typeid(x) == typeid(z) ) << '\n';
    std::cout << std::boolalpha << is_array<char_pointer>::value << '\n';
    std::cout << std::boolalpha << is_pointer<char_pointer>::value << '\n';
    }

    This will print:
    true
    true
    false

    false
    false
    true


    Maybe, you are correct within the context of the C programming language,
    though.



    Best

    Kai-Uwe Bux
    Kai-Uwe Bux, Oct 8, 2005
    #10
  11. Dale <> writes:
    > Mark McIntyre <> wrote in
    > news::
    >> On 07 Oct 2005 17:53:50 GMT, in comp.lang.c , Dale <>
    >> wrote:
    >>>"Davy" <> wrote in news:1128661915.425811.133260
    >>>@g44g2000cwa.googlegroups.com:
    >>>>
    >>>> char x[4]={"my"};
    >>>
    >>>Remember. sweetums, 'x' is a pointer when you declare it that way.

    >>
    >> Actually, no, this is terribly terribly wrong. In neither declaration
    >> is 'x' a pointer - its an array[4] of char.

    >
    > You're the one who's wrong, here, fucknut -- 'x' is a character pointer
    > when you declare it that way. That's how C stores an array in memory;
    > i.e., as a pointer to a chunk of RAM.


    Dale, let me offer some friendly advice.

    First, don't be rude.

    Second, don't be simultaneously rude and wrong.

    Arrays are not pointers. Pointers are not arrays. An array is not
    stored in memory as "a pointer to a chunk of RAM", it's stored in
    memory as an array.

    The declaration
    char x[4];
    declares an array object, with or without an initialization. It does
    not declare a pointer object.

    I think what's confused you is the fact that an array name, or any
    expression of an array type, is implicitly converted to a pointer to
    the array's first element in most contexts. (The exceptions are the
    operand of the unary "&" or "sizeof" operator, and a string literal in
    an initializer.)

    > Run this little program and observe the output:
    >
    > int main(void)
    > {
    >
    > char x[4]={"my"};
    >
    > printf("%c\n", x);
    > printf("%c\n", *x);
    >
    > return 0;
    > }
    >
    > The first printf() will display garbage (because it's actually printing n
    > the value of a pointer) but the second will display the letter 'm'
    > (because it's printing the value that the pointer points to). If 'x'
    > were not a pointer then this wouldn't even fucking compile because '*x'
    > would be considered invalid indirection.


    The first printf() invokes undefined behavior. The expression x,
    which is of array type, is implicitly converted to a pointer value
    of type char*. Passing this as an argument to printf() with a "%c"
    format invokes undefined behavior. It happens to display garbage,
    but since you're lying to the compiler it could do anything.

    In the second printf(), the subexpression x is again converted to
    a value of type char*. Dereferencing this pointer value yields the
    character value 'm', so you're right about this one.

    And of course you're missing the require "#include <stdio.h>, so
    *any* call to printf() invokes undefined behavior. On many (most?)
    implementations, it happens to work anyway, but you shouldn't count
    on that.

    The relationship between arrays and pointers is a common source of
    confusion among C newbies. You need to read section 6, "Arrays and
    Pointers", of the C FAQ (google "C FAQ" to find it). I see that this
    thread is cross-posted to comp.lang.c and comp.lang.c++ (which is
    rarely a good idea), but this happens to be an area where C and C++
    are similar.

    > Dumbass.


    There's a good chance that a lot of the regulars in these newsgroups
    have already killfiled you, or will do so as soon as they see your
    article. You may already have permanently damaged your ability to
    participate here and to benefit from the advice of experts.

    Be embarrassed.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
    Keith Thompson, Oct 8, 2005
    #11
  12. Davy

    Skarmander Guest

    Dale wrote:
    > Mark McIntyre <> wrote in
    > news::
    >
    >
    >>On 07 Oct 2005 17:53:50 GMT, in comp.lang.c , Dale <>
    >>wrote:
    >>
    >>>"Davy" <> wrote in news:1128661915.425811.133260
    >>>@g44g2000cwa.googlegroups.com:
    >>>
    >>>> char x[4]={"my"};
    >>>
    >>>Remember. sweetums, 'x' is a pointer when you declare it that way.

    >>
    >>Actually, no, this is terribly terribly wrong. In neither declaration
    >>is 'x' a pointer - its an array[4] of char.

    >
    >
    > You're the one who's wrong, here, fucknut -- 'x' is a character pointer
    > when you declare it that way. That's how C stores an array in memory;
    > i.e., as a pointer to a chunk of RAM.
    >

    I'm afraid the fucknut is quite correct. A character pointer is not a
    character array. An array can be implicitly converted to a pointer and
    the [] construct can be applied to pointers, which is not the same thing.

    If 'x' were only a character pointer, what memory is "my" being written
    to? 'x' is a character array here. Go read the standard if you don't
    believe it. Or read the FAQ. Specifically section 6:
    http://www.eskimo.com/~scs/C-faq/s6.html

    <snipped code where the implicit conversion from array to pointer is
    demonstrated>
    > Dumbass.


    Pleased to meet you. Language aside, the courtesy of reading the FAQ of
    a newsgroup you're posting to benefits all involved.

    S.
    Skarmander, Oct 8, 2005
    #12
  13. Kai-Uwe Bux <> writes:
    > Dale wrote:
    >> Mark McIntyre <> wrote in
    >> news::
    >>> On 07 Oct 2005 17:53:50 GMT, in comp.lang.c , Dale <>
    >>> wrote:
    >>>>"Davy" <> wrote in news:1128661915.425811.133260
    >>>>@g44g2000cwa.googlegroups.com:
    >>>>>
    >>>>> char x[4]={"my"};
    >>>>
    >>>>Remember. sweetums, 'x' is a pointer when you declare it that way.
    >>>
    >>> Actually, no, this is terribly terribly wrong. In neither declaration
    >>> is 'x' a pointer - its an array[4] of char.

    >>
    >> You're the one who's wrong, here, fucknut -- 'x' is a character pointer
    >> when you declare it that way. That's how C stores an array in memory;
    >> i.e., as a pointer to a chunk of RAM.

    >
    > I see that you have set the follow-ups to comp.lang.c. However, as your
    > original comment was posted in comp.lang.c++, too, be informed that, in the
    > context of C++, you are not correct with respect to the type of 'x'.

    [snip]
    > Maybe, you are correct within the context of the C programming language,
    > though.


    No, he's equally wrong in C.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
    Keith Thompson, Oct 8, 2005
    #13
  14. Davy

    Flash Gordon Guest

    Dale wrote:
    > Mark McIntyre <> wrote in
    > news::
    >
    >>On 07 Oct 2005 17:53:50 GMT, in comp.lang.c , Dale <>
    >>wrote:
    >>
    >>>"Davy" <> wrote in news:1128661915.425811.133260
    >>>@g44g2000cwa.googlegroups.com:
    >>>
    >>>> char x[4]={"my"};
    >>>
    >>>Remember. sweetums, 'x' is a pointer when you declare it that way.

    >>
    >>Actually, no, this is terribly terribly wrong. In neither declaration
    >>is 'x' a pointer - its an array[4] of char.

    >
    > You're the one who's wrong,


    No is isn't.

    > here, fucknut


    why resort to abuse? All it does is make *you* look bad and probably
    make at least some of the knowledgeable people around here plonk you
    reducing the chance of you getting useful help when you need it.

    > -- 'x' is a character pointer
    > when you declare it that way.


    No, x is an array of char. Try checking any decent book on C (or C++) or
    the comp.lang.c FAQ or the standard or any of the times this has been
    discussed before.

    > That's how C stores an array in memory;
    > i.e., as a pointer to a chunk of RAM.


    No. If it was a pointer you could assign to x, but every conforming
    compiler will diagnose it as an error.

    > Run this little program and observe the output:
    >
    > int main(void)
    > {
    >
    > char x[4]={"my"};
    >
    > printf("%c\n", x);
    > printf("%c\n", *x);
    >
    > return 0;
    > }
    >
    > The first printf() will display garbage (because it's actually printing
    > the value of a pointer)


    No, it might do anything because an array decays to a pointer to its
    first element in this situation and that is not what you have said you
    will print.

    > but the second will display the letter 'm'
    > (because it's printing the value that the pointer points to). If 'x'
    > were not a pointer then this wouldn't even fucking compile because '*x'
    > would be considered invalid indirection.


    No, it compiles because this is one of the many situations in which an
    array will decay to a pointer to the first element.

    > Dumbass.


    That description would appear to apply to you, not Mark. I suggest you
    try actually learning the language before claiming people are wrong and
    insulting them.
    --
    Flash Gordon
    Living in interesting times.
    Although my email address says spam, it is real and I read it.
    Flash Gordon, Oct 8, 2005
    #14
  15. Dale wrote:
    > Mark McIntyre <> wrote in
    > news::
    >>On 07 Oct 2005 17:53:50 GMT, in comp.lang.c , Dale <>
    >>wrote:
    >>>"Davy" <> wrote in news:1128661915.425811.133260
    >>>@g44g2000cwa.googlegroups.com:
    >>>
    >>>> char x[4]={"my"};
    >>>
    >>>Remember. sweetums, 'x' is a pointer when you declare it that way.

    >>
    >>Actually, no, this is terribly terribly wrong. In neither declaration
    >>is 'x' a pointer - its an array[4] of char.

    >
    >
    > You're the one who's wrong, here, fucknut -- 'x' is a character pointer
    > when you declare it that way. That's how C stores an array in memory;
    > i.e., as a pointer to a chunk of RAM.


    Just because you are completely wrong does not mean that you must use
    abusive language. Cursing at Mark will not make your cluelessness
    suddenly appear to be enlightenment. In
    char x[4] = {"x");
    x is an array of char, not a pointer, and only the as yet still ignorant
    think otherwise. When the ignorant loudly declare their ignorance to be
    truth, as you did, that correctable ignorance is transformed into
    stubborn and boorish stupidity.

    >
    > Run this little program and observe the output:


    Don't bother.
    To start with, the variadic function printf() requires a declaration in
    scope. Dale, who properly signs himself below as "Dumbass", left this out.

    >
    > int main(void)
    > {
    >
    > char x[4]={"my"};
    >
    > printf("%c\n", x);


    As everyone but Dale who styles himself "Dumbass" knows, when an array
    is passed as an argument, the value passed is a pointer to the beginning
    of that array. Nothing constructive can be said about whether x is an
    array or not can be said from a situation in which a pointer is passed
    whether x is an array or a pointer. We can, however, say that anyone
    who thinks he could pass either an array or a pointer to printf and
    expect anything meaningful from the absurd use of the "%c" specifier
    should not be giving lessons to anyone. He needs to be rereading the
    more elementary parts of his C text instead.

    > printf("%c\n", *x);
    >
    > return 0;
    > }
    >
    > The first printf() will display garbage (because it's actually printing
    > the value of a pointer) but the second will display the letter 'm'
    > (because it's printing the value that the pointer points to). If 'x'
    > were not a pointer then this wouldn't even fucking compile because '*x'
    > would be considered invalid indirection.


    We already know that the above argument is garbage. What Dale perhaps
    should look at (extra brackets retained)
    is:
    #include <stdio.h>

    int main(void)
    {

    char x[] = { "The array named 'x' has this." };
    char *y = { "The pointer named 'y' points to this." };

    printf("The array x (\"%s\") has size %lu\n", x,
    (unsigned long) sizeof(x));
    printf("The pointer y (\"%s\") has size %lu\n", y,
    (unsigned long) sizeof(y));

    return 0;
    }


    [Output for this implementation]
    The array x ("The array named 'x' has this.") has size 30
    The pointer y ("The pointer named 'y' points to this.") has size 4

    >
    > Dumbass.


    If you want to use a .sig, remember to place the .sig separator before it.
    Martin Ambuhl, Oct 8, 2005
    #15
  16. Davy

    Default User Guest

    Dale wrote:


    > You're the one who's wrong, here, fucknut -- 'x' is a character
    > pointer when you declare it that way. That's how C stores an array
    > in memory; i.e., as a pointer to a chunk of RAM.



    Besides being dead wrong, you're a jerk. So it's a quick plonk for you.



    Brian
    Default User, Oct 8, 2005
    #16
  17. On 08 Oct 2005 19:26:59 GMT, in comp.lang.c , Dale <>
    wrote:

    >Mark McIntyre <> wrote in
    >news::
    >
    >> Actually, no, this is terribly terribly wrong. In neither declaration
    >> is 'x' a pointer - its an array[4] of char.

    >
    >You're the one who's wrong, here, fucknut


    You're amusingly wrong, as well as abusive. Arrays are not pointers.

    >Run this little program and observe the output:


    (program which passes an array and its first element to printf())

    Which proves nothing. When passed to a function, an array argument
    decays into a pointer to its first element. Please read the FAQ (6.3
    onwards I believe) and the ISO standard if you need more detail,

    Anyway, if we're writing test cases, try this one:

    #include <stdio.h>
    int main(void)
    {
    int x[365];
    return printf("%d %d\n", sizeof(x), sizeof(*x));
    }

    And then ask yourself how large the pointers are on your system...

    >The first printf() will display garbage (because it's actually printing
    >the value of a pointer)


    well, actually it prints garbage because %c and array[4] of int are
    incompatible, and you've invoked undefined behaviour.

    >Dumbass.


    Physician, heal thyself.
    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
    Mark McIntyre, Oct 9, 2005
    #17
  18. On Sat, 08 Oct 2005 22:32:20 +0200, in comp.lang.c , Skarmander
    <> wrote:

    >Dale wrote:
    >> Mark McIntyre <> wrote in
    >>>Actually, no, this is terribly terribly wrong. In neither declaration
    >>>is 'x' a pointer - its an array[4] of char.

    >>
    >>
    >> You're the one who's wrong, here, fucknut --
    >>

    >I'm afraid the fucknut is quite correct.


    Whoy, I resemble that remark!
    :)

    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
    Mark McIntyre, Oct 9, 2005
    #18
  19. Davy

    Dale Guest

    Mark McIntyre <> wrote in
    news::

    > On 08 Oct 2005 19:26:59 GMT, in comp.lang.c , Dale <>
    > wrote:
    >
    >>Mark McIntyre <> wrote in
    >>news::
    >>
    >>> Actually, no, this is terribly terribly wrong. In neither declaration
    >>> is 'x' a pointer - its an array[4] of char.

    >>
    >>You're the one who's wrong, here, fucknut

    >
    > You're amusingly wrong, as well as abusive.


    Too bad you can't prove me wrong, huh, Mr. Thinskin.

    > Arrays are not pointers.


    I've already shown that an identifier declared as an array of characters is
    a character type pointer. You have failed to demonstrate otherwise.
    Dale, Oct 9, 2005
    #19
  20. On 09 Oct 2005 08:50:01 GMT, in comp.lang.c , Dale <>
    wrote:

    >Mark McIntyre <> wrote in
    >
    >> Arrays are not pointers.

    >
    >I've already shown that an identifier declared as an array of characters is
    >a character type pointer.


    What you've demonstrated is
    a) that when passed to a function, an array decays into a pointer to
    its first element
    b) you're an idiot

    >You have failed to demonstrate otherwise.


    Actually, I've failed to demonstrate that you can learn from your
    mistakes. For that I apologise.

    *plonk*
    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
    Mark McIntyre, Oct 9, 2005
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mladen Adamovic
    Replies:
    0
    Views:
    726
    Mladen Adamovic
    Dec 4, 2003
  2. Mladen Adamovic
    Replies:
    3
    Views:
    14,565
    Mladen Adamovic
    Dec 5, 2003
  3. Matt
    Replies:
    3
    Views:
    485
    Tor Iver Wilhelmsen
    Sep 17, 2004
  4. Bruce Sam
    Replies:
    15
    Views:
    7,878
    John C. Bollinger
    Nov 19, 2004
  5. =?Utf-8?B?UmFqZXNoIHNvbmk=?=

    'System.String[]' from its string representation 'String[] Array'

    =?Utf-8?B?UmFqZXNoIHNvbmk=?=, May 4, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,787
    =?Utf-8?B?UmFqZXNoIHNvbmk=?=
    May 4, 2006
Loading...

Share This Page