Core Dump and Segmentation Fault in C/C++

Ayush Gupta
Updated on 16-Mar-2020 09:54:10

5K+ Views

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

Convert Strings to Numbers in C/C++

Ayush Gupta
Updated on 16-Mar-2020 09:52:05

276 Views

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

Convert String to Integer Array in C/C++

Ayush Gupta
Updated on 16-Mar-2020 09:50:25

3K+ Views

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

Convert String to Uppercase or Lowercase Using STL in C++

Ayush Gupta
Updated on 16-Mar-2020 09:47:51

5K+ Views

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

CSS Cue Property

karthikeya Boyini
Updated on 16-Mar-2020 08:20:02

184 Views

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 −    

Flip Animation Effect with CSS

Nancy Den
Updated on 16-Mar-2020 08:16:47

240 Views

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

Flash Animation Effect with CSS

Samual Sam
Updated on 16-Mar-2020 08:16:05

325 Views

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();          }          

Values to Set Page Size in CSS

Daniol Thomas
Updated on 16-Mar-2020 08:14:58

2K+ Views

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

Fade Out Up Big Animation Effect with CSS

Lakshmi Srinivas
Updated on 16-Mar-2020 08:13:53

96 Views

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();          }          

Fade Out Up Animation Effect with CSS

George John
Updated on 16-Mar-2020 08:12:15

151 Views

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();          }          

Advertisements