C Language Tutorial

C Switch Case: C Switch Case Syntax & Switch Case Example

C Switch Case: C Switch Case Syntax & Switch Case Example

C switch case is a multiple branch selection statement in which the value of an expression is checked against a list of integers or character constants. C switch case can be used to perform one of the several possible action depending of the evaluated value of a logical expression or character or integer constant. C Switch Case Syntax switch(expression) {… Read more →

C if Statement, If Else Statement & Else If Statement

C if statement, if else statement and else if statement enable programmers to selectively execute certain statements, thus, adding decision making capability to the c language. if Statement The general form of if statement is given below: if(condition) { statement_1; statement_2; . . . statement_n; } Above, condition is any valid logical or relational condition and statement_1, statement_2, …., statement_n… Read more →

C Global Variables & C Local Variables: C Variable Scope

By the scope of variables in c, we mean that from which parts of the program any particular variable could be accessed. Thus, depending on the scope of variables in c language, variables could be classified as follows: Global Variables Global variables in c have their declaration outside the function definition of all functions used with in the program and… Read more →

C Bitwise Operators

C bitwise operators allows manipulation of data at bit level. It should also be noted that these operators cannot be applied on floating point numbers. Available C bitwise operators are as follows: Bitwise AND Operator (&) When two values are operated by bitwise & operator, the binary representation of both values are compared bit by bit. If each corresponding bit… Read more →

C Storage Class Specifiers – auto, register & extern

C storage class specifiers determines the physical location in memory within the computer where the variable declared in c would be actually stored. Storage class specifiers also determines The initial value of the variable, if an initial value is not assigned. The life of a variable. The scope of the variable. Available c storage class specifiers in the c programming… Read more →

C Programming Error Types – Runtime, Compile & Logical Errors

While writing c programs, errors also known as bugs in the world of programming may occur unwillingly which may prevent the program to compile and run correctly as per the expectation of the programmer. Basically there are three types of errors in c programming: Runtime Errors Compile Errors Logical Errors C Runtime Errors C runtime errors are those errors that… Read more →

C Type Conversion – Implicit & Explicit Type Conversion in C

When variables and constants of different types are combined in an expression then they are converted to same data type. The process of converting one predefined type into another is called type conversion. Type conversion in c can be classified into the following two types: Implicit Type Conversion When the type conversion is performed automatically by the compiler without programmers… Read more →

Hello World C Program

Hello World C Program

In this tutorial, we will write a very simple hello world c program which will print “Hello World!” on the screen. The source code with the basic structure of a c program is also given below: Hello World C Program Source Code Output C Program Structure Every c program consists of several building blocks known as functions which may include… Read more →

C Variables: Declaration & Initialization of C Variables

C variables are names used for storing a data value to locations in memory. The value stored in the c variables may be changed during program execution. Declaration of Variable Declaration of variable in c can be done using following syntax: data_type variable_name; or data_type variable1, variable2,…,variablen; where data_type is any valid c data type and variable_name is any valid… Read more →

Data Types in C: Primitive Data Types in C Language

Data types in C programming language enables the programmers to appropriately select the data as per requirements of the program and the associated operations of handling it. Data types in c language can be broadly classified as: Primitive Data Types User Defined Data Types, for example, enum, structure, union Derived Data Types, for example, array, pointers In this tutorial we… Read more →