mardi 21 juin 2022

How to fix segmentation fault in C++ [closed]

I have one function Chekusers() which requires 4 argument, if I pass only 3 arguments so by default what value will be picked for 4th element. It is causing segmentation fault.

Function call:

Checkusers(u1, u2, u3):

Function definition:

int Checkusers(int u1, int u2, int u3, int u4) 
{
   FirstAndLastUsers(u1, u4); //here I am getting segmentation fault

}

I am using gdb compiler, i am not getting compile time error but it gives segmentation fault at run time. How to fix it.

Aucun commentaire:

Enregistrer un commentaire