Posts

Showing posts with the label C Introduction

Keywords and Identifiers

C Programming Keywords and Identifiers In this tutorial, you will learn about keywords; reserved words in C programming that are part of the syntax. Also, you will learn about identifiers and proper way to name a variable. Character set Character set is a set of alphabets, letters and some special characters that are valid in C language. Alphabets Uppercase: A B C ................................... X Y Z Lowercase: a b c ...................................... x y z C accepts both lowercase and uppercase alphabets as variables and functions. Digits 0 1 2 3 4 5 6 7 8 9 Special Characters Special Characters in C Programming , < > . _ ( ) ; $ : % [ ] # ? ' & { } " ^ ! * / | - \ ~ + White space Characters blank space, new line, horizontal tab, carriage return and form feed C Keywords Keywords are predefined, reserved words used in programming that have special meanings to the compiler. Keywords are part of the syntax and they ca...

C Data Types

Image
C Programming Data Types In this tutorial, you will learn about data types and how to declare a variable in C programming. In C programming, variables or memory locations should be declared before it can be used. Similarly, a function also needs to be declared before use. Data types simply refers to the type and size of data associated with  variables  and functions. Data types in C Fundamental Data Types Integer types Floating type Character type Derived Data Types Arrays Pointers Structures Enumeration This tutorial will focus on fundamental data types. To learn about derived data types, visit the corresponding tutorial. int - Integer data types Integers are whole numbers that can have both positive and negative values but no decimal values. Example: 0, -5, 10 In C programming, keyword  int  is used for declaring integer variable. For example: int id; Here,  id  is a variable of type integer. You can de...

Input-Output

Image
C Input-Output (I/O) This tutorial focuses on two in-built functions printf() and scanf() to perform I/O task in C programming. Also, you will learn to write a valid program in C. C programming has several  in-built library functions  to perform input and output tasks. Two commonly used functions for I/O (Input/Output) are printf() and scanf(). The  scanf()  function reads formatted input from standard input (keyboard) whereas the  printf()  function sends formatted output to the standard output (screen). Example #1: C Output #include <stdio.h> //This is needed to run printf() function. int main () { printf ( "C Programming" ); //displays the content inside quotation return 0 ; } Output C Programming How this program works? All valid C program must contain the  main()  function. The code execution begins from the start of  main()  function. The  printf()  is a library...

Constants and Variables

Image
C Programming Constants and Variables In this tutorial, you will learn about variables, rules for naming a variable, constants and different type of constants in C programming. Variables In programming, a variable is a container (storage area) to hold data. To indicate the storage area, each variable should be given a unique name ( identifier ). Variable names are just the symbolic representation of a memory location. For example: int playerScore = 95; Here,  playerScore  is a variable of integer type. The variable is assigned value: 95. The value of a variable can be changed, hence the name 'variable'. In C programming, you have to declare a variable before you can use it. Rules for naming a variable in C A variable name can have letters (both uppercase and lowercase letters), digits and underscore only. The first letter of a variable should be either a letter or an underscore. However, it is discouraged to start variable name with an underscor...

C Operators

Image
C Programming Operators C programming has various operators to perform tasks including arithmetic, conditional and bitwise operations. You will learn about various C operators and how to use them in this tutorial. An operator is a symbol which operates on a value or a variable. For example:  +  is an operator to perform addition. C programming has wide range of operators to perform various operations. For better understanding of operators, these operators can be classified as: Operators in C programming Arithmetic Operators Increment and Decrement Operators Assignment Operators Relational Operators Logical Operators Conditional Operators Bitwise Operators Special Operators C Arithmetic Operators An arithmetic operator performs mathematical operations such as addition, subtraction and multiplication on numerical values (constants and variables). Operator Meaning of Operator + addition or unary plus - subtraction or unary minus * multiplica...