Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6233965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:23:52+00:00 2026-05-24T10:23:52+00:00

When a segmentation fault occurs, the printf() before it does not execute. main() {

  • 0

When a segmentation fault occurs, the printf() before it does not execute.

main()
{
 printf( "something" );
 statement;  //this statement causes a segmentation fault
}

In the situation above, why does the printf() not execute?

So do I need to use valgrind in such a case(which prints all printf() before the faulty statement).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:23:53+00:00Added an answer on May 24, 2026 at 10:23 am

    An output stream can fail to be output before a program crash but you can force the bytes to be output by flushing them with fflush().

    I usually do it with something like this:

    if (trace) { fflush(stdout); }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to catch segmentation fault in third party library cleanup operations. This happens
I am getting segmentation fault in this code but i cant figure out why.
I'm trying to solve a segmentation fault. This message appears in my apache-error.log: [notice]
I'm getting a segmentation fault when I try to do pthread_mutex_lock(&_mutex). This is really
this gives me a segmentation fault: for (int i=0; !file.eof();i++) { getline(file,line); roughInput.lines[i].split(line); }
I am receiving a Segmentation Fault error when I run this program. To summarize,
I am getting a segmentation fault error when I run this code. I don't
I am getting a segmentation fault while running this code. I can't work out
Why do I get segmentation fault in this function: #include <stdio.h> #include <stdlib.h> #include
This is an extended question from How can i remove this Segmentation fault in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.