Search:

Type: Posts; User: lilydjwg

Search: Search took 0.01 seconds.

  1. Replies
    6
    Views
    2,128

    hilarius, so you mean two following two lines are...

    hilarius, so you mean two following two lines are the same, right?


    char *p = "abc";
    const char *p = "abc";

    And, if you know C++, is it the reason that g++ will warn char *p = "abc" for p is...
  2. Replies
    6
    Views
    2,128

    If so, why can I when in gdb or use char p[]...

    If so, why can I when in gdb or use char p[] instead of char *p? What's the difference between them?
  3. Replies
    6
    Views
    2,128

    Segmentation fault when changing a string

    #include<stdio.h>
    int main(){
    char *p = "Abc";
    *p = 'a';
    printf("%s\n", p);
    return 0;
    }
    It received SIGSEGV on the 3rd line. But if I use
    char p[] = "Abc";, it goes well.
    So why I...
  4. Oh, I see. Thank you!

    Oh, I see. Thank you!
  5. How can I get a fixed length string without side-effect?

    Hi there,

    Here is what I've tried:


    #include<stdio.h>

    int main(){
    char str[10];
    int a;
Results 1 to 5 of 5