Union in C

In this article, you’ll learn about unions in C programming. More specifically, how to create unions, access its members and learn the differences between unions and structures. User defined data type : Union Like structures in C, union is a user defined data type. In union, all members share the same memory location. Unions are conceptually similar to… Read More »

C Program to reverse a given number

In this example, you will learn to reverse the given number using these two methods. Examples : Input : 123 Output : 321 Input : 1995 Output : 5991 Approach used : We can reverse a number in c using loop and arithmetic operators. Take input number Find its quotient and remainder. Multiply the separate variable with 10… Read More »

Structures in C

A structure is a user defined data type in C. A structure creates a data type that can be used to group items of possibly different types into a single type. Structure is similar as Array, but only difference is that array allows only similar data type that can be stored in contiguous manner, but structure can stores… Read More »

Data Types in C | Set 1

Data types define the type of data a variable can hold. C language has some predefined set of data types to handle various kinds of data that we can use in our program. These datatypes have different storage capacities. In C programming, data types are declarations for variables. This determines the type and size of data associated with… Read More »

Hello World Program in C

In this article, you will learn to print “Hello, World!” on the screen in C programming. Most students of programming languages, start from the famous ‘Hello World’ code. This program prints ‘Hello World’ when executed. In the first program we are displaying the message using printf function and in the second program we are calling a user defined… Read More »

C standard library

Prerequisite – C language C standard library (libc) is the standard library for the C programming language, as specified in the ANSI C standard. C standard library is also called the ISO C library. The C library functions are provided by the system and stored in the library. The C library function is also called an in-built function… Read More »

Functions in C

A function is a block of code that performs a specific task. It is a set of statements that take inputs, do some specific computation and produces output. A function can be called multiple times to provide reusability and modularity to the C program. Example : Advantage of functions in C : There are the following advantages of… Read More »

Loops in C | Set 2

Loops are very useful when you want to perform a task repeatedly. Loops are used to execute a set of statements repeatedly until a particular condition is satisfied. A loop consists of two parts, a body of a loop and a control statement. The purpose of the loop is to repeat the same code a number of times.… Read More »

Decision Making in C

C conditional statements allow you to make a decision, based upon the result of a condition. These statements are called Decision Making Statements or Conditional Statements. Decision making statements available in C are: if statement if..else statements nested if statements if-else-if ladder switch statements Jump Statements: break continue goto return 1. if statement – If a certain condition… Read More »