Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions segment default
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// C++ program to demonstrate Segmentation Fault
#include <iostream>
using namespace std;

// Driver Code
int main()
{
// An array of size 100
int arr[100] = { 0 };

// When we try to access the array out
// of bound, it will give Segmentation Fault
cout << arr[100001];
return 0;
}
// C++ program to demonstrate TLE
#include <iostream>
using namespace std;

// Driver Code
int main()
{
// Below statement will give time
// limit exceeded as well as memory
// limit exceeded due to infinite loop
for (;;) {
int arr[10000];
}
return 0;
}