Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Segmentation fault?

[es] :: C/C++ programiranje :: Segmentation fault?

[ Pregleda: 2101 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

onako

Član broj: 256314
Poruke: 75
*.dynamic.isp.telekom.rs.



Profil

icon Segmentation fault?26.04.2010. u 17:55 - pre 169 meseci
Take a look at the following code:
Code:

typedef std::vector<unsigned int> VecUnsRAM;
VecUnsRAM myPos(vertices.size());
unsigned int count=0;
for(unsigned int j=0; j<vertices.size();++j) {
        myP t=std::make_pair(count, vertices[j].D);
    std::cout<<"Got here"<<std::endl;
    PQ[j]=t;
    std::cout<<"Got here"<<std::endl;
    myPos[j]=count;// or myPos[j]=j; produces Seg fault error
    std::cout<<"Got here"<<std::endl;
    ++count;
    
    }


The output is "Got here" twice, and then the Seg fault. Any ideas why this happens?
Thanks
 
Odgovor na temu

kiklop74
Darko Miletić
Buenos Aires

Član broj: 78422
Poruke: 569
*.fibertel.com.ar.

Sajt: ar.linkedin.com/pub/darko..


+13 Profil

icon Re: Segmentation fault?26.04.2010. u 22:54 - pre 169 meseci
You can not send incomplete piece of code and expect any kind of answer. When asking a question try to create minimal COMPLETE program, that reproduces the error and send that code here. Than you can expect reasonable answer.

with this code I can only say this:

What type is used for vertices?
What is PQ?

What exactly are you trying to do with this code?
Tko leti vrijedi
 
Odgovor na temu

karas

Član broj: 5574
Poruke: 482
*.dynamic.sbb.rs.



+1 Profil

icon Re: Segmentation fault?27.04.2010. u 21:29 - pre 169 meseci
cross posted: http://forums.devshed.com/c-pr...segmentation-fault-698764.html , http://cboard.cprogramming.com...126230-segmentation-fault.html
Sveti Avgustin: "Dobar hrišćanin treba da se kloni matematičara i svih onih koji daju lažna proročanstva. Postoji opasnost da su matematičari već sklopili pakt sa Đavolom, da pomrače čovekov um i da ga okuju okovima pakla."
 
Odgovor na temu

Wajda.W
Vladimir Vajda
Zrenjanin

Član broj: 127039
Poruke: 323
*.dynamic.isp.telekom.rs.



+101 Profil

icon Re: Segmentation fault?28.04.2010. u 17:44 - pre 169 meseci
cross posted on one more:
http://www.codeguru.com/forum/showthread.php?t=496408
 
Odgovor na temu

kiklop74
Darko Miletić
Buenos Aires

Član broj: 78422
Poruke: 569
200.49.157.*

Sajt: ar.linkedin.com/pub/darko..


+13 Profil

icon Re: Segmentation fault?28.04.2010. u 21:40 - pre 169 meseci
Ma ovaj tip je za ignorisanje, ima autistican pristup komunikaciji.
Tko leti vrijedi
 
Odgovor na temu

[es] :: C/C++ programiranje :: Segmentation fault?

[ Pregleda: 2101 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.