memmove Function in C/C++

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

610 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

949 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

307 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

397 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

410 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

408 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

Java Float isNaN Method

Samual Sam
Updated on 26-Jun-2020 08:04:00

179 Views

The isNan() method returns true if the Float value is a Not-a-Number (NaN). Let’s say we have the following Float values.Float f1 = new Float(5.0/0.0); Float f2 = new Float(10.2/0.0); Float f3 = new Float(0.0/0.0);Check with isNaN() method.f1.isNaN (); f2.isNaN (); f3.isNaN ();The following is the complete example with output.Example Live Demoimport java.lang.*; public class Demo {    public static void main(String args[]) {       Float f1 = new Float(5.0/0.0);       Float f2 = new Float(10.2/0.0);       Float f3 = new Float(0.0/0.0);       System.out.println(f1.isNaN());       System.out.println(f2.isNaN());       System.out.println(f3.isNaN());   ... Read More

strchr Function in C/C++

Samual Sam
Updated on 26-Jun-2020 08:03:47

380 Views

The function strchr() is used to search the character in the string. It search the first occurrence of character which is passed as second argument and it returns a pointer to the character, if successful otherwise, NULL.Here is the syntax of strchr() in C language, char *strchr(const char *string , int character)Here, string − The string which is to be scanned to search the character.character − The character which is to be searched in the string.Here is an example of strchr() in C language, Example Live Demo#include #include int main() {    char s[] = "Helloworld!";    char c = 'o'; ... Read More

Use OFFSET in Android SQLite

Smita Kapse
Updated on 26-Jun-2020 08:03:26

584 Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to access this database, you don't need to establish any kind of connections for it like JDBC, ODBC etc.This example demonstrate about How to use OFFSET in Android sqliteStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create ... Read More

Advertisements