In this tutorial, we will be discussing a program to understand core dump (segmentation fault) in C/C++.It happens due to reasons like when code tries to write on read only memory or tries to access corrupt memory location.ExampleModifying a string literalint main(){ char *str; str = "GfG"; *(str+1) = 'n'; return 0; }Accessing out of array index bounds#include using namespace std; int main(){ int arr[2]; arr[3] = 10; return 0; }Accessing an address which is freed#include #include int main(void){ int* p = malloc(8); *p = 100; free(p); *p = 110; return 0; }OutputAbnormal termination of program
In this tutorial, we will be discussing a program to understand how to convert strings into numbers in C/C++.C/C++ provides two ways to convert strings into numbers.Example Live DemoUsing sscanf()#include int main(){ const char *str = "12345"; int x; sscanf(str, "%d", &x); printf("The value of x : %d", x); return 0; }OutputThe value of x : 12345Using stoi() Live Demo#include #include using namespace std; int main(){ string str1 = "45"; string str2 = "3.14159"; string str3 = "31337 geek"; int myint1 = stoi(str1); int myint2 = stoi(str2); int myint3 = stoi(str3); cout
In this tutorial, we will be discussing a program to understand how to convert a string into integer array in C/C++.For this we will create a new array. Traverse through the given string, if the character is a comma “, ”, we move on to the next character else add it to the new array.Example Live Demo#include using namespace std; //converting string to integer array void convert_array(string str){ int str_length = str.length(); int arr[str_length] = { 0 }; int j = 0, i, sum = 0; //traversing the string for (i = 0; str[i] != ... Read More
In this tutorial, we will be discussing a program to understand conversion of whole string to uppercase or lowercase using STL in C++.To perform this transformation, C++ STL provides toupper() and tolower() functions to convert to uppercase and lowercase respectively.Example Live Demo#include using namespace std; int main(){ string su = "Tutorials point"; transform(su.begin(), su.end(), su.begin(), ::toupper); cout
The cue property is a shorthand for setting cue-before and cue-after. If two values are given, the first value is cue-before and the second is cue-after. If only one value is given, it applies to both properties.ExampleFor example, the following two rules are equivalent −
An Element can turn over or cause to turn over with a sudden quick movement.ExampleLive Demo .animated { background-image: url(/css/images/logo.png); background-repeat: no-repeat; background-position: left top; padding-top:95px; margin-bottom:60px; -webkit-animation-duration: 1s; animation-duration: 1s; -webkit-animation-fill-mode: both; animation-fill-mode: both; ... Read More
A sudden brief burst of bright light of an element creates a Flash effect.ExampleLive Demo .animated { background-image: url(/css/images/logo.png); background-repeat: no-repeat; background-position: left top; padding-top:95px; margin-bottom:60px; -webkit-animation-duration: 1s; animation-duration: 1s; -webkit-animation-fill-mode: both; animation-fill-mode: both; } @keyframes flash { 0%, 50%, 100% { opacity: 1; } 25%, 75% { opacity: 0; } } .flash { animation-name: flash; } Reload page function myFunction() { location.reload(); }
There are four values that can be used to set page size −auto − The page box will be set to the size and orientation of the target sheet.landscape − Overrides the target's orientation. The page box is the same size as the target, and the longer sides are horizontal.portrait − Overrides the target's orientation. The page box is the same size as the target, and the shorter sides are horizontal.length − Length values for the 'size' property create an absolute page box. If only one length value is specified, it sets both the width and height of the page box. Percentage values are ... Read More
To implement Fade Out Up Big Animation Effect on an image with CSS, you can try to run the following code −ExampleLive Demo .animated { background-image: url(/css/images/logo.png); background-repeat: no-repeat; background-position: left top; padding-top:95px; margin-bottom:60px; -webkit-animation-duration: 10s; animation-duration: 10s; -webkit-animation-fill-mode: both; animation-fill-mode: both; } @-webkit-keyframes fadeOutUpBig { 0% { opacity: 1; -webkit-transform: translateY(0); } 100% { opacity: 0; -webkit-transform: translateY(-2000px); } } @keyframes fadeOutUpBig { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-2000px); } } .fadeOutUpBig { -webkit-animation-name: fadeOutUpBig; animation-name: fadeOutUpBig; } Reload page function myFunction() { location.reload(); }
To implement Fade Out Up Animation Effect on an image with CSS, you can try to run the following codeExampleLive Demo .animated { background-image: url(/css/images/logo.png); background-repeat: no-repeat; background-position: left top; padding-top:95px; margin-bottom:60px; -webkit-animation-duration: 10s; animation-duration: 10s; -webkit-animation-fill-mode: both; animation-fill-mode: both; } @-webkit-keyframes fadeOutUp { 0% { opacity: 1; -webkit-transform: translateY(0); } 100% { opacity: 0; -webkit-transform: translateY(-20px); } } @keyframes fadeOutUp { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-20px); } } .fadeOutUp { -webkit-animation-name: fadeOutUp; animation-name: fadeOutUp; } Reload page function myFunction() { location.reload(); }