SIGSEGV when compile with `g++ -march=native -g` on Intel with AVX CPUs
I have a problem with g++14.2 and previous versions.
Simply trying to use opendir() in my program gives me segmentation fault. Im on vscode and in my schools linux sever
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.h> #include <sys/types.h> #define MAX 100 int copy(char fileName[], char dirName[]) { printf(“0”); //open directory and test if it opens successfully DIR *OGdir = opendir(“~/”); struct dirent *OGdp = readdir(OGdir); if(OGdir == NULL) { printf(“nUnable To Open Directoryn”); return(-1); } printf(“1n”); //more code will go here i have […]
Segmentation Error even after dynamically allocating memory and enough disk space
I have few very large arrays which I want to use to store some calculations. The arrays are of size 10000003,25003*3, 1000000,1000000.I have used malloc to dynamically allocate memory to all the arrays before using any of them.
segmentation fault in c++ programme
the below code is a c++ program that calculates the sum of the letters in given text.
Segmentation fault in C BogoSort
I’ve started learning c and wanted to program bogosort with it. I coded the most parts, but as I started it, I’ve got a segmentation fault error, but don’t know why.
Segmentation fault in my matrix-reading program
I created a program that is supposed to read two 3D matrices from a binary file, multiply them, and print the result to a binary file. However, while it successfully compiles, when I run it, it gives me a segmentation fault error.
enter a substring and a string and remove substring from string in C
I cannot run this following code since getting segmentation fault. In the main i enter a string and a substring, whereas in the function i catch the substring and remove it from the string using memmove.
Segmentation error while solving a beginner prob in C++
Given an integer vector and a value k,rotate the array k times clockwise.
Eg- {1,2,3,4,5} on rotating twice becomes {4,5,1,2,3}
What are common reasons for segmentation faultS when using map in C++?
In the project I’ve been coding recently, creating a new map inside a certain function and adding two elements to it causes a segmentation fault. These same lines (which are completely unrelated to the rest of the program), run completely fine in separate projects or online compilers, what could be the reason for the segmentation fault this time? how can lines that have nothing to do with the rest of the program run badly in this case?
Why does this code result in a segmentation fault?
I have the following code to print a vector in c++. It works fine for non-empty vectors, but for some reason it gives a segmentation fault when you try to print an empty vector.