Could anyone tell me why the piece of code below is giving segmentation
fault, and how to correct this.....

#include <stdio.h>

#define buffer_size 2000000000
#define num_writers 300
#define num_readers 500

int main()
{
        char *ptr;
        char *shmptr[num_writers];
        int i, numr, numw, nump;

        unsigned long cksum = 0;

        numr = nump % num_readers;
        numw = nump - numr;
        numw = numw / num_readers;
        ptr =  shmptr[numw];


        for(i = 0; i < buffer_size; i++)
         cksum += *ptr++;

}
-- 
View this message in context: 
http://www.nabble.com/What%27s-wrong-in-the-code-tp19397260p19397260.html
Sent from the C-prog mailing list archive at Nabble.com.

Reply via email to