segmentation error

Discussion in 'C Programming' started by JK, May 7, 2007.

  1. JK

    JK Guest

    Hi,

    I am getting segmentation error with the below mentioned code and I am
    not able to make out why.

    typedef struct sd {
     
    JK, May 7, 2007
    #1
    1. Advertising

  2. In article <>,
    JK <> wrote:
    >Hi,
    >
    >I am getting segmentation error with the below mentioned code and I am
    >not able to make out why.
    >
    >typedef struct sd {
    >


    I rather doubt you're getting far enough to get a segfault with the code
    you posted.


    dave

    --
    Dave Vandervies
    I've never seen the detailed design for Babbage's "anticipating carriage"
    [...] but if he could design that, he might well have been able to design
    a Vector Analytical Engine too. --Steve VanDevender in the SDM
     
    Dave Vandervies, May 7, 2007
    #2
    1. Advertising

  3. JK

    Old Wolf Guest

    (Dave Vandervies) wrote:
    > JK <> wrote:
    >
    > >I am getting segmentation error with the below mentioned code and I am
    > >not able to make out why.

    >
    > >typedef struct sd {

    >
    > I rather doubt you're getting far enough to get a segfault with the code
    > you posted.


    Are you saying there is something wrong with the code
    you quoted?

    As far as I can see, the code would be well-defined except for
    the return type of main, and failure to include stdlib.h.

    (Some compilers -- and obviously the OP's -- would in fact
    get far enough to segfault, with the posted code).
     
    Old Wolf, May 7, 2007
    #3
  4. In article <>,
    Old Wolf <> wrote:
    >(Dave Vandervies) wrote:
    >> JK <> wrote:


    >> >I am getting segmentation error with the below mentioned code and I am
    >> >not able to make out why.


    >> >typedef struct sd {


    >> I rather doubt you're getting far enough to get a segfault with the code
    >> you posted.


    >Are you saying there is something wrong with the code
    >you quoted?


    >As far as I can see, the code would be well-defined except for
    >the return type of main, and failure to include stdlib.h.


    >(Some compilers -- and obviously the OP's -- would in fact
    >get far enough to segfault, with the posted code).


    JK's original posting had *only* that one line of code, quoted
    above. No closing brace, no semi-colon, no main, no #include's at all.
    It seems unlikely that that one line of code by itself would compile to an
    executable on any compiler.
    --
    If you lie to the compiler, it will get its revenge. -- Henry Spencer
     
    Walter Roberson, May 7, 2007
    #4
  5. JK

    Old Wolf Guest

    On May 8, 9:43 am, -cnrc.gc.ca (Walter Roberson)
    wrote:
    > JK's original posting had *only* that one line of code, quoted
    > above. No closing brace, no semi-colon, no main, no #include's at all.
    > It seems unlikely that that one line of code by itself would compile to an
    > executable on any compiler.


    Ah, that post didn't appear where I'm reading, but his subsequent
    correct post did. Throw in a few more faulty assumptions and
    you get my post..:)
     
    Old Wolf, May 8, 2007
    #5
    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. Oleg
    Replies:
    9
    Views:
    12,959
  2. CBFalconer

    Re: fclose cause segmentation error

    CBFalconer, Feb 17, 2005, in forum: C Programming
    Replies:
    2
    Views:
    373
    Kenneth Brody
    Feb 17, 2005
  3. Rob Morris

    Re: fclose cause segmentation error

    Rob Morris, Feb 17, 2005, in forum: C Programming
    Replies:
    0
    Views:
    513
    Rob Morris
    Feb 17, 2005
  4. Rufus V. Smith

    Re: fclose cause segmentation error

    Rufus V. Smith, Feb 17, 2005, in forum: C Programming
    Replies:
    0
    Views:
    377
    Rufus V. Smith
    Feb 17, 2005
  5. questions?

    what's reason to have a segmentation error?

    questions?, Feb 27, 2006, in forum: C Programming
    Replies:
    9
    Views:
    733
    Dave Thompson
    Mar 6, 2006
Loading...

Share This Page