Read Mode Operation of Files in C Language

Bhanu Priya
Updated on 24-Mar-2021 13:25:59

993 Views

File is collection of records or is a place on hard disk, where data is stored permanently.Need of filesEntire data is lost when a program terminates.Storing in a file preserves the data even if, the program terminates.If you want to enter a large amount of data, normally it takes a lot of time to enter them all.We can easily access the content of files by using few commands.You can easily move your data from one computer to another without changes.By using C commands, we can access the files in different ways.Operations on filesThe operations on files in C programming language ... Read More

Difference Between Inline and Macro in C++

AmitDiwan
Updated on 24-Mar-2021 13:24:36

1K+ Views

In this post, we will understand the difference between inline and macro in C++.InlineIt is a function in C++.It is parsed by the compiler.It can be defined inside or outside the class.It evaluates the argument only once.The compiler may not convert all functions to ‘inline’ function and expand them all.The short functions that are defined inside the class are automatically made as inline functions.An inline function inside a class can access the data members of the class.Inline function can be terminated using curly brackets.It is easy to debug.This is because error checking is done during compilation.It binds all statements in ... Read More

Write Mode Operation of Files in C Language

Bhanu Priya
Updated on 24-Mar-2021 13:22:38

915 Views

File is collection of records or is a place on hard disk, where data is stored permanently.Need of filesEntire data is lost when a program terminates.Storing in a file preserves the data even if, the program terminates.If you want to enter a large amount of data, normally it takes a lot of time to enter them all.We can easily access the content of files by using few commands.You can easily move your data from one computer to another without changes.By using C commands, we can access the files in different ways.Operations on filesThe operations on files in C programming language ... Read More

Separate Even and Odd Numbers in an Array Using For Loop in C

Bhanu Priya
Updated on 24-Mar-2021 13:18:59

2K+ Views

An array is a group of related data items that are stored with single name.For example, int student[30]; //student is an array name that holds 30 collection of data items with a single variable nameOperations of arraySearching − It is used to find whether particular element is present or notSorting − It helps in arranging the elements in an array either in ascending or descending order.Traversing − It processes every element in an array sequentially.Inserting − It helps in inserting the elements in an array.Deleting − It helps in deleting an element in an array.The logic to find even numbers ... Read More

Difference Between Checked and Unchecked Exception in Java

AmitDiwan
Updated on 24-Mar-2021 13:17:47

14K+ Views

In this post, we will understand the difference between checked and unchecked exceptions in Java.Checked ExceptionsThey occur at compile time.The compiler checks for a checked exception.These exceptions can be handled at the compilation time.It is a sub-class of the exception class.The JVM requires that the exception be caught and handled.Example of Checked exception- ‘File Not Found Exception’Unchecked ExceptionsThese exceptions occur at runtime.The compiler doesn’t check for these kinds of exceptions.These kinds of exceptions can’t be caught or handled during compilation time.This is because the exceptions are generated due to the mistakes in the program.These are not a part of the ... Read More

Perform Arithmetic Operations on Two-Dimensional Array in C

Bhanu Priya
Updated on 24-Mar-2021 13:17:01

3K+ Views

An array is a group of related data items that are stored with single name.For example, int student[30]; //student is an array name that holds 30 collection of data items with a single variable nameOperations of arraySearching − It is used to find whether particular element is present or notSorting − It helps in arranging the elements in an array either in ascending or descending order.Traversing − It processes every element in an array sequentially.Inserting − It helps in inserting the elements in an array.Deleting − It helps in deleting an element in an array.The logic applied to perform arithmetic ... Read More

Difference Between Interface and Abstract Class in Java

AmitDiwan
Updated on 24-Mar-2021 13:13:43

701 Views

In this post, we will understand the difference between abstract class and interface in Java and C#.Abstract ClassIt contains the declaration and definition part.Multiple inheritance can’t be implemented using abstract class.It contains the constructor.It can also contain some static members.It can contain multiple types of access modifiers such as public, private, protected.The performance of an abstract class is very good, because it is quick.It is used to implement the core identity/functionality of a class.A class can use only one abstract class.If many implementations are same, and they have a common behaviour, it is suggested to use an abstract class.Abstract classes ... Read More

Perform Arithmetic Operations on Arrays in C Language

Bhanu Priya
Updated on 24-Mar-2021 13:12:55

4K+ Views

An array is a group of related data items that are stored with single name.For example, int student[30]; //student is an array name that holds 30 collection of data items with a single variable nameOperations of arraySearching − It is used to find whether particular element is present or notSorting − It helps in arranging the elements in an array either in ascending or descending order.Traversing − It processes every element in an array sequentially.Inserting − It helps in inserting the elements in an array.Deleting − It helps in deleting an element in an array.The logic to perform all arithmetic ... Read More

Replace All Occurrences of a Character in a String in C

Bhanu Priya
Updated on 24-Mar-2021 13:12:15

8K+ Views

Enter a string at run time and read a character to replace at console. Then, finally read a new character that has to be placed in place of an old character where ever it occurs inside the string.Program1Following is the C program to replace all occurrence of a character − Live Demo#include #include int main(){    char string[100], ch1, ch2;    int i;    printf("enter a string : ");    gets(string);    printf("enter a character to search : ");    scanf("%c", &ch1);    getchar();    printf("enter a char to replace in place of old : ");    scanf("%c", &ch2);    for(i = 0; i

Find Product of Given Digits Using For Loop in C Language

Bhanu Priya
Updated on 24-Mar-2021 13:11:50

3K+ Views

The user has to enter a number, then divide the given number into individual digits, and finally, find the product of those individual digits using for loop.The logic to find the product of given digits is as follows −for(product = 1; num > 0; num = num / 10){    rem = num % 10;    product = product * rem; }Example1Following is the C program to find the product of digits of a given number by using for loop − Live Demo#include int main(){    int num, rem, product;    printf("enter the number : ");    scanf("%d", & num); ... Read More

Advertisements