Thread: Segmentation Fault related to the malloc usage in an iterative loop

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    8

    Segmentation Fault related to the malloc usage in an iterative loop

    Dear Programmers,
    I developed a program with the pointer as matm. And now i want to use it iteratively for different files called from the same directory through my program. It is very big program. So i am writing the referred lines here in the attached file (appended below). As soon as the control reaches to second iteration in the last loop at for(i=0;i<1;i++).
    It runs correctly only when the i<1 in the above loop. As soon as i> 1, it says Segmentation Failure, doesn't run further and is is aborted.
    May you please solve me this issue? I understand somewhere there is some problem with calling the matm pointer. But please guide me where is the problem and find the desired code modules attached referred in the mail.

    Please go through the attachment for the same.

    Thanks & Regards
    Ashish Runthala
    Attached Files Attached Files

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why does this malloc give me a segmentation fault?
    By Xpl0ReRChR in forum C Programming
    Replies: 14
    Last Post: 01-09-2012, 12:05 PM
  2. Replies: 3
    Last Post: 03-12-2011, 08:28 PM
  3. Segmentation fault with Malloc
    By uniprog in forum C Programming
    Replies: 7
    Last Post: 12-02-2010, 10:22 AM
  4. malloc + segmentation fault
    By ch4 in forum C Programming
    Replies: 5
    Last Post: 04-07-2009, 03:46 PM
  5. malloc segmentation fault
    By BharathKumar in forum C Programming
    Replies: 5
    Last Post: 06-27-2007, 02:53 AM

Tags for this Thread