strtod Function in C/C++

karthikeya Boyini
Updated on 26-Jun-2020 08:10:10

422 Views

The function strtod() is used to convert the string to a floating point number. The string is converted into double type number. It returns the converted number, if successful otherwise, zero. This is declared in “stdlib.h” header file.Here is the syntax of strtod() in C language, double strtod(const char *string, char **endpointer);Here, string − The string to be converted.endpointer − The pointer of already allocated object and its value is set to the next character by the function after the numeric value.Here is an example of strtod() in C language, Example Live Demo#include #include int main () {   ... Read More

Format Message with Integer Fillers in Java

Chandu yadav
Updated on 26-Jun-2020 08:09:10

394 Views

To format message with integer fillers in Java, we use the MessageFormat class. The MessageFormat class gives us a way to produce concatenated messages which are not dependent on the language. The MessageFormat class extends the Serializable and Cloneable interfaces.Declaration − The java.text.MessageFormat class is declared as follows −public class MessageFormat extends FormatThe MessageFormat.format(pattern, params) method formats the message and fills in the missing parts using the objects in the params array matching up the argument numbers and the array indices.The format method has two arguments, a pattern and an array of arguments. The pattern contains placeholder in {} curly ... Read More

Set All Background Image Properties in CSS

Samual Sam
Updated on 26-Jun-2020 08:09:05

177 Views

The CSS background property is used to set all the background image properties in one section.ExampleYou can try to run the following code to implement the background property:Live Demo                    #demo {             background: lightblue url("https://www.tutorialspoint.com/css/images/css-mini-logo.jpg") no-repeat fixed top;          }                              www.tutorialspoint.com          Tutorials Point originated from the idea that there exists a             class of readers ... Read More

memmove Function in C/C++

karthikeya Boyini
Updated on 26-Jun-2020 08:09:03

618 Views

The function memmove() is used to move the whole memory block from one position to another. One is source and another is destination pointed by the pointer. This is declared in “string.h” header file in C language.Here is the syntax of memmove() in C language, void *memmove(void *dest_str, const void *src_str, size_t number)Here, dest_str − Pointer to the destination array.src_str − Pointer to the source array.number − The number of bytes to be copied from source to destination.Here is an example of memmove() in C language, Example Live Demo#include #include int main () {    char a[] = "Firststring"; ... Read More

memcpy Function in C/C++

Samual Sam
Updated on 26-Jun-2020 08:08:37

6K+ Views

The function memcpy() is used to copy a memory block from one location to another. One is source and another is destination pointed by the pointer. This is declared in “string.h” header file in C language. It does not check overflow.Here is the syntax of memcpy() in C language, void *memcpy(void *dest_str, const void *src_str, size_t number)Here, dest_str − Pointer to the destination array.src_str − Pointer to the source array.number − The number of bytes to be copied from source to destination.Here is an example of memcpy() in C language, Example Live Demo#include #include int main () {   ... Read More

Difference Between strlen and sizeof for String in C

karthikeya Boyini
Updated on 26-Jun-2020 08:07:54

962 Views

strlen()The function strlen() is a predefined function in C language. This is declared in “string.h” header file. It is used to get the length of array or string.Here is the syntax of strlen() in C language, size_t strlen(const char *string);Here, string − The string whose length is to be calculated.Here is an example of strlen() in C language, Example Live Demo#include #include int main () {    char s1[10] = "Hello";    int len ;    len = strlen(s1);    printf("Length of string s1 : %d", len );    return 0; }OutputLength of string s1 : 10In the above ... Read More

ungetc in C/C++

Samual Sam
Updated on 26-Jun-2020 08:06:26

318 Views

The function ungetc() takes a character and pushes it back to the stream so that the character could be read again.Here is the syntax of ungetc() in C language, int ungetc(int character, FILE *stream)Here, character − The character to be pushed back to stream.stream − The pointer to the file object.Here is an example of ungetc() in C language, Example#include int main() {    int c;    while ((c = getchar()) != '0')    putchar(c);    ungetc(c, stdin);    c = getchar();    putchar(c);    puts("");    printf("The End!");    return 0; }Outputs a b c t h 0 ... Read More

Convert Decimal Integer to Hexadecimal Number in Java

karthikeya Boyini
Updated on 26-Jun-2020 08:06:13

407 Views

To convert decimal integer to hexadecimal, use the Integer.toHexString() method. Let’s say the following is our decimal integer.int decInt = 25;The following is the usage of the Integer.toHexString() method to convert decimal integer to hexadecimal number.String myHex = Integer.toHexString(decInt);The following the complete example.Example Live Demopublic class Demo {    public static void main(String []args) {       int decInt = 25;       System.out.println("Decimal Integer = "+decInt);       String myHex = Integer.toHexString(decInt);       System.out.println("Hexadecimal = "+myHex);    } }OutputDecimal Integer = 25 Hexadecimal = 19

atexit Function in C/C++

karthikeya Boyini
Updated on 26-Jun-2020 08:05:54

417 Views

The function atexit() is used to call the function after the normal exit of program. The program is called without any parameters. The function atexit() is called after exit(). The termination function can be called anywhere in the program. This function is declared in “stdlib.h” header file.Here is the syntax of atexit() in C language, int atexit(void (*function_name)(void))Here, function_name − The function is to be called at the time of termination of program.Here is an example of atexit() in C language, Example Live Demo#include #include void func1 (void) {    printf("Exit of function 1"); } void func2 (void) { ... Read More

Raise Function in C/C++

Samual Sam
Updated on 26-Jun-2020 08:05:21

419 Views

The function raise() is used to send the signals to the program. The predefined function signal() is invoked. It is implemented to check whether it will ignore the signal or invoke the signal handler. This is declared in “signal.h” header file. It returns zero, if successful otherwise, non-zero value.Here is the syntax of raise() in C language, int raise(int signal)Here, signal − The signal number to be invoked.Here is an example of raise() in C language, Example Live Demo#include #include void handler(int sig) {    printf("Signal received : %d", sig); } int main() {    signal(SIGILL, handler);    printf("Sending ... Read More

Advertisements