
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1339 Articles for C

3K+ Views
An expression is a combination of operators and operands which reduces to a single value. An operation is performed on a data item which is called an operand. An operator indicates an operation to be performed on data.For example, z = 3+2*1z = 5Primary expressions − It is an operand which can be a name, a constant or any parenthesized expression. Example − c = a+ (5*b);Postfix expressions − In a postfix expression, the operator will be after the operand. Example − ab+Prefix expressions − n a prefix expression, the operator is before the operand. Example − +abUnary expression − ... Read More

3K+ Views
A ‘C’ program contains executable statements. A compiler helps to translate the executable statements into machine language.When a user runs the program, he/she machines the language statements which are executed by the compiler.Types of executable statementsThe types of executable statements in C language are as follows −Input – output statementsAssignment statementsInput-output statementsStoring a value into memory is called ‘input operation’.After executing the computations, the results are stored in memory and the results can be displayed to the user by ‘output operation’.All i/o operations are performed using input / output functions.The most common I/O functions are supplied through the preprocessor directive ... Read More

12K+ Views
Let us first understand, what is a variable.VariableIt is the name for memory location that may be used to store a data value.A variable may take different values at different times during execution.A variable name may be chosen by the programmer in a meaningful way, so as to reflect its function (or) nature in the program.For example, sum, avg, total etc.Rules for naming variableThe rules for naming a variable are explained below −They must begin with a letter.Maximum length of variable is 31 characters in ANSI standard. But, first eight characters are significant by many compilers.Upper and lowercase characters are ... Read More

4K+ Views
The link and definition sections are called as preprocessor directives. It gives instructions to the compiler to link function from the system library.For example, the definition section defines all the symbolic constants.#includeFor example, #define PI 3.1415The preprocessor directives must start with # symbol.Without link definition the program will not execute for some compilers. It helps the compiler to link the predefined functions from system library.Predefined FunctionsThe predefined functions present in stdio.h are as follows −FunctionDescriptionprintf()Print the character, string, float, integer, octal onto the screen.scanf()Read a character, string, numeric data from keyboard.getc()Reads character from file.gets()Reads line from keyboard.getchar()Reads character from keyboard.puts()Writes ... Read More

1K+ Views
In this program, we are trying to sort out the odd numbers and even numbers that are present in one file. Then, we try to write all odd numbers in ODD file and even numbers into EVEN file.Open a file DATA in write mode and write some numbers into the file and later on close it.Again, Open DATA file in read mode.Open ODD file in write mode.Open EVEN file in write mode.Then, perform the operations to check odd and even numbers by using while loop.After that close all files.ExampleFollowing is the C program to handle integer data files using file ... Read More

7K+ Views
The pre-processor is a tool that processes the source code before it passes through the compiler. It work as an initial phase of compilation where it operates under the control of different command lines or directives. Pre-processor Directives in C Pre-processor is placed in the source program before the main line, it begins with the symbol "#" in column one and does not require a semicolon at the end. The commonly used pre-processor directives are − #define #undef #include #ifdef #endif #if #else The pre-processor directives are divided into three categories − Macro substitution directives. File inclusion ... Read More

10K+ Views
Enter two numbers at console during runtime. Then, declare the flag variable which is used to check whether the number is prime or not with the help of for loop condition.Whenever, the flag is zero, it prints the prime number and if flag is one, it exists from the loop.ProgramFollowing is the C program to display the prime numbers in between two intervals − Live Demo#include int main(){ int number1, number2, i, j, flag; printf("enter the two intervals:"); scanf("%d %d", &number1, &number2); printf("prime no’s present in between %d and %d:", number1, number2); for(i=number1+1;iRead More

4K+ Views
The sum of first and last digit for a number can be calculated if we use the below mentioned algorithm in C programming language.AlgorithmRefer an algorithm given herewith −START Step 1: Declare no, sum variables of type int Step 2: Read a number at runtime Step 3: Compute sum=no%10 Step 4: While loop no>9 No=no/10 Step 5: Compute sum=sum+no; Step 6: Print sum STOPExampleFollowing is the C program to find the sum of first and last digit for a number − Live Demo#include int main(){ unsigned int no, sum; printf("enter any number:"); scanf("%u", &no); sum=no%10; ... Read More

10K+ Views
C program is defined by set of protocols that are to be followed by a programmer, while writing the code.SectionsThe complete program is divided into different sections, which are as follows −Documentation Section − Here, we can give commands about program like author name, creation or modified date. The information written in between/* */ or // is called as comment line. These lines are not considered by the compiler while executing.Link section − In this section, header files that are required to execute the program are included.Definition section − Here, variables are defined and initialised.Global declaration section − In this ... Read More

380 Views
If we are generating random numbers in a program, it is necessary to control the series of numbers.The randomize() and srand() functions are used to seed the random number generator.The process of assigning the random number generators starting number is called seeding the generators.The randomize() uses PC’s clock to produce a random seed.srand() allows us to specify the random number generator’s starting value.ProgramGiven below is the C program on rand − Live Demo#include int main(){ // create same sequence of // random numbers on every time the program runs for(int i = 0; i