Exforsys
+ Reply to Thread
Results 1 to 2 of 2

Kindly mention the Cases

This is a discussion on Kindly mention the Cases within the C and C++ forums, part of the Programming Talk category; What are the conditions or scenarios under which one may get Segmentation fault in C programming language? If someone could ...

  1. #1
    cyrus is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    128

    Kindly mention the Cases

    What are the conditions or scenarios under which one may get Segmentation fault in C programming language? If someone could mention this I will take care while coding my C program.


  2. #2
    priyaraji is offline Member Array
    Join Date
    Apr 2006
    Answers
    52
    Segmentation fault in occurs mainly when a memory area that is not allowed to be accessed is tried to be used.

    For example if you have a C code as below placed in a memory protected platform:

    char *a = "Example";
    *a = 'T';


    Then on compilation of the above program you would get segmentation fault as the Example string was tried to be placed in area of memory marked as read only.


Latest Article

Network Security Risk Assessment and Measurement

Read More...