Answer the question
In order to leave comments, you need to log in
What is "Segmentation error (memory dumped)"?
The program compiles, but at startup it gives a message -
Segmentation error (dumped memory)
#include <stdio.h>
#include <stdlib.h>
void number_printer(int number);
int main(int argc, char **argv)
{
int num = atoi(argv[1]);
number_printer(num);
return 0;
}
void number_printer (int number)
{
int num;
printf("Enter number: ");
scanf("%d ", &num);
switch(num){
case 0: printf("Zero, ");
break;
case 1: printf("One, ");
break;
case 2: printf("Two, ");
break;
case 3: printf("Three, ");
break;
default: printf("%d ", num);
break;
}
}
Answer the question
In order to leave comments, you need to log in
The program tried to access data in an inaccessible memory segment. Error in callprintf("%d ", num);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question