Sponsored Content
Top Forums Programming Reason for Segmentation fault Post 302141789 by kahuna on Monday 22nd of October 2007 10:57:53 AM
Old 10-22-2007
Quote:
Originally Posted by royalibrahim
Code:
   char *ch; (or) ch = 'A';   // but if it assigned to any string then no segmentation fault

It's not clear what your actual code is. If you do not assign a value to the character pointer "ch", then it is pointing to an undefined location in memory and so it is not surprising that this would error. If you assign 'A' to ch, you are assigning the hex value of 'A' to the POINTER, which probably is not pointing to a valid memory location.
 

10 More Discussions You Might Find Interesting

1. Programming

segmentation fault

hi all i'm trying to execute a c program under linux RH and it gives me segmentation fault, this program was running under unix at&t anybody kow what the problem could be? thanx in advance regards (2 Replies)
Discussion started by: omran
2 Replies

2. AIX

Segmentation fault

Hi , During execution a backup binary i get following error "Program error 11 (Segmentation fault), saving core file in '/usr/datatools" Riyaz (2 Replies)
Discussion started by: rshaikh
2 Replies

3. Linux

Segmentation fault

Hi, on a linux Red HAT(with Oracle DB 9.2.0.7) I have following error : RMAN> delete obsolete; RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 2 using channel ORA_DISK_1 Segmentation fault What does it mean ? And the solution ? Many thanks. (0 Replies)
Discussion started by: big123456
0 Replies

4. UNIX for Dummies Questions & Answers

Segmentation Fault

Hi, While comparing primary key data of two tables thr bteq script I am getting this Error. This script is a shell script. *** Error: The following error was encountered on the output file. Script.sh: 3043492 Segmentation fault(coredump) Please let me know how to get through it. ... (5 Replies)
Discussion started by: monika
5 Replies

5. Programming

segmentation fault

If I do this. Assume struct life { char *nolife; } struct life **life; // malloc initialization & everything if(life->nolife == 0) Would I get error at life->nolife if it is equal to 0. wrong accession? (3 Replies)
Discussion started by: joey
3 Replies

6. Programming

segmentation fault

What is segmentation fault(core dumped) (1 Reply)
Discussion started by: gokult
1 Replies

7. Programming

Using gdb, ignore beginning segmentation fault until reproduce environment segmentation fault

I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this : i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies

8. Homework & Coursework Questions

Segmentation Fault

this is a network programming code to run a rock paper scissors in a client and server. I completed it and it was working without any error. After I added the findWinner function to the server code it starts giving me segmentation fault. -the segmentation fault is fixed Current problem -Also... (3 Replies)
Discussion started by: femchi
3 Replies

9. Programming

Segmentation fault

I keep getting this fault on a lot of the codes I write, I'm not exactly sure why so I'd really appreciate it if someone could explain the idea to me. For example this code #include <stdio.h> main() { unsigned long a=0; unsigned long b=0; int z; { printf("Enter two... (2 Replies)
Discussion started by: sizzler786
2 Replies

10. Programming

C. To segmentation fault or not to segmentation fault, that is the question.

Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1... I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one. Below are two very condensed snippets of which I have added the results inside the each code section. IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies
pfm_cleanup(3ncs)														 pfm_cleanup(3ncs)

Name
       pfm_cleanup - establish a clean-up handler

Syntax
       #include <idl/c/base.h>
       #include <idl/c/pfm.h>

       status_$t pfm_$cleanup(cleanup_record)
       pfm_$cleanup_rec *cleanup_record;

Arguments
       cleanup_record	   A  record  of the context when is called.  A program should treat this as an opaque data structure and not try to alter
			   or copy its contents.  It is needed by and to restore the context of the calling process at the clean-up handler  entry
			   point.

Description
       The  routine  establishes a clean-up handler that is executed when a fault occurs.  A clean-up handler is a piece of code executed before a
       program exits when a signal is received by the process.	The clean-up handler begins where is called; the routine registers an entry  point
       with the system where program execution resumes when a fault occurs.  When a fault occurs, execution resumes after the most recent call to

       There  can  be  more  than one clean-up handler in a program.  Multiple clean-up handlers are executed consecutively on a last-in/first-out
       basis, starting with the most recently established handler and ending with the first clean-up  handler.	 The  system  provides	a  default
       clean-up  handler  established at program invocation.  The default clean-up handler is always called last, just before a program exits, and
       releases any system resources still held, before returning control to the process that invoked the program.

Diagnostics
       When called to establish a clean-up handler, returns the status pfm_$cleanup_set to indicate the clean-up handler was  successfully  estab-
       lished.	 When the clean-up handler is entered in response to a fault signal, effectively returns the value of the fault that triggered the
       handler.

       This section lists status codes for errors returned by this routine in

       pfm_$bad_rls_order  Attempted to release a clean-up handler out of order.

       pfm_$cleanup_not_found
			   There is no pending clean-up handler.

       pfm_$cleanup_set    A clean-up handler was established successfully.

       pfm_$cleanup_set_signaledl
			   Attempted to use pfm_$cleanup_set as a signal.

       pfm_$invalid_cleanup_rec
			   Passed an invalid clean-up record to a routine.

       pfm_$no_space	   Cannot allocate storage for a clean-up handler.  Clean-up handler code runs with asynchronous faults  inhibited.   When
			   returns  something  other  than  pfm_$cleanup_set indicating that a fault has occurred, there are four possible ways to
			   leave the clean-up code:

			   o	  The program can call to start the next clean-up handler with a different fault signal.

			   o	  The program can call to start the next clean-up handler with the same fault signal.

			   o	  The program can continue with the code following the clean-up handler.  It should  generally	call  to  reenable
				  asynchronous	faults.   Execution  continues from the end of the clean-up handler code; it does not resume where
				  the fault signal was received.

			   o	  The program can reestablish the handler by calling before proceeding.

Files
See Also
       intro(3ncs), pfm_signal(3ncs)

																 pfm_cleanup(3ncs)
All times are GMT -4. The time now is 01:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy