I'm having a bit of trouble with an excercise for C++ (for reference, I use SSH to connect to my University and code using Unix with g++ compiler).
This simple piece of code (which after much stress over being unable to get the function to work on my own) I copied directly from a sample excercise and it still gives me the following when I try to excecute it: "Segmentation Fault". Can somebody tell me - what's wrong here?
P.S. Can somebody also explain what a segmentation error is in the first place?Code:#include <iostream> #include <stdlib.h> using namespace std ; void main( int argc, char* argv[] ) { int marks[5] ; int total = 0 ; for ( int i = 0; i < 6; i++) { marks[i] = atoi(argv[i+1]) ; } }



LinkBack URL
About LinkBacks



CornedBee