Found 33676 Articles for Programming

What is an algorithm and flowchart in C language?

Bhanu Priya
Updated on 24-Jan-2025 16:17:59

33K+ Views

The algorithm is a step–by–step procedure that is helpful in solving a problem. If it is written in English-like sentences then, it is called PSEUDO CODE. It is a formula or a set of steps that solves a particular problem for a specified problem. Each step in the algorithm must be specified clearly. A programming algorithm is a process or formula for solving a problem. It involves a sequence of specified actions that describe how to perform a task, which the computer executes consistently. An algorithm follows a procedure consisting of inputs and produces a result, known as the output. ... Read More

State the importance of C language and its general structure

Bhanu Priya
Updated on 11-Mar-2021 08:36:53

7K+ Views

C programming is a general-purpose, procedural, imperative computer programming language.Importance of C LanguageC is called as a robust language, which has so many built-in functions and operations, which can be used to write any complex program.Generally, we use to call C as a middle level language. Because, the ‘C’ compiler combines the capabilities of an assembly language with the features of a high-level language. Therefore, it is best for writing both system software and business packages.‘C’ Programs are efficient and fast.C is highly portable, that is, ‘C’ programs written on one computer can be run on another with little (or) ... Read More

Differentiate the NULL pointer with Void pointer in C language

Sindhura Repala
Updated on 06-Dec-2024 15:41:23

12K+ Views

The difference between a Null pointer and a Void pointer is that a Null pointer represents a value, while a Void pointer is a type identifier. NULL Pointer A null pointer indicates that it does not point to anything. If a pointer has no assigned address, it should be set to null. Each pointer type, such as int* or char*, can have a null pointer value. The syntax is as follows − * = NULL; Example Following is the C program for NULL pointer − #include int main() { printf("TutorialPoint C ... Read More

What happens if we include header file for two times in a C program?

Bhanu Priya
Updated on 11-Mar-2021 08:16:08

1K+ Views

C header files include some predefined functions. For example, printf() and scanf() functions are defined in the stdio.h header file.Each header files in C contains different predefined functions to make programs simple to understand.When a header file is included two times in a C program, the second one gets ignored. In actual, the #, called the include, preceding a header file ensures that it is included only once during the compilation process.Example 1Following is the C program for computing an average of three numbers − Live Demo#include #include //header file included twice ,ignored by compiler main(){    int a, b, c, ... Read More

What are the different searching techniques in C language?

Bhanu Priya
Updated on 11-Mar-2021 07:59:07

10K+ Views

Searching technique refers to finding a key element among the list of elements.If the given element is present in the list, then the searching process is said to be successful.If the given element is not present in the list, then the searching process is said to be unsuccessful.C language provides two types of searching techniques. They are as follows −Linear searchBinary searchLinear SearchSearching for the key element is done in a linear fashion.It is the simplest searching technique.It does not expect the list to be sorted.Limitation − It consumes more time and reduce the power of system.Input (i/p)Unsorted list of ... Read More

Explain the sorting techniques in C language

Bhanu Priya
Updated on 09-Dec-2024 16:28:32

42K+ Views

In this article, we are going to learn about the different sorting techniques and their implementations in C language. Sorting in C programming requires rearranging elements in the array into a determined order, i.e., in ascending or descending order. This will use the comparison operator to specify the new order of a list or array. This is widely used in different applications that include searching algorithms, data structure optimization, and database management. The following are the sorting techniques that we can implement with C language and other programming also: ... Read More

Explain feof() function in C language with a program

Bhanu Priya
Updated on 13-Mar-2021 11:18:45

463 Views

ProblemHow the C compiler detect that the file was reached the end for while reading? Explain with a program.Solutionfeof() is a file handling function in C language, which is used to find end of a file.The logic we used for finding end of file is as follows −fp = fopen ("number.txt", "r"); //open a file printf ("file content is"); for (i=0;i

How to print the content into the files using C language?

Bhanu Priya
Updated on 11-Mar-2021 07:51:00

255 Views

We can write a program in C for printing some content in to the file and print the following −Number of characters entered into the file.Reverse the characters entered into the file.First, try to store number of characters into the file by opening the file in write mode.For entering data into file, we use the logic as mentioned below −while ((ch = getchar( ))!=EOF) {//after enter data press cntrl+Z to terminate    fputc(ch, fp); }With the help of ftell, rewind, fseek functions, we can reverse the content that we already entered into the file.ExampleGiven below is a C program for ... Read More

C program to display relation between pointer to pointer

Bhanu Priya
Updated on 11-Mar-2021 07:10:58

298 Views

In C programming language, pointer to pointer or double pointer is a variable that holds the address of another pointer.DeclarationGiven below is the declaration for pointer to pointer −datatype ** pointer_name;For example, int **p;Here, p is a pointer to pointer.Initialization‘&’ is used for initialization.For example, int a = 10; int *p; int **q; p = &a;AccessingIndirection operator (*) is used for accessingSample programFollowing is the C program for double pointer − Live Demo#include main ( ){    int a = 10;    int *p;    int **q;    p = &a;    q = &p;    printf("a =%d ", a);   ... Read More

C Program for copying the contents of one file into another file

Bhanu Priya
Updated on 11-Mar-2021 07:09:19

23K+ Views

File is a collection of records (or) is a place on hard disk, where data is stored permanently. By using C commands, we can access the files in different ways.Operations on filesThe operations that can be carried out on files in C language are as follows −Naming the file.Opening the file.Reading from the file.Writing into the file.Closing the file.SyntaxThe syntax for opening and naming file is as follows −FILE *File pointer;For example, FILE * fptr;File pointer = fopen ("File name”, "mode”);For example, fptr = fopen ("sample.txt”, "r”);FILE *fp; fp = fopen ("sample.txt”, "w”);The syntax for reading from file is as ... Read More

Advertisements