Posts

C if...else Statement

Image
C if...else Statement In programming, decision making is used to specify the order in which statements are executed. In this tutorial, you will learn to create decision making program using if...else statements. C if statement if (testExpression) { // statements } The  if  statement evaluates the test expression inside the parenthesis. If the test expression is evaluated to true (nonzero), statements inside the body of  if  is executed. If the test expression is evaluated to false (0), statements inside the body of  if  is skipped from execution. To learn more on when test expression is evaluated to nonzero (true) and 0 (false), check out  relational  and  logical operators . Flowchart of if statement Example #1: C if statement // Program to display a number if user enters negative number // If user enters positive number, that number won't be displayed #include <stdio.h> int main () { i...

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...

List of all Keywords in C Language

Image
List of all Keywords in C Language This tutorial provides a brief information on all 32 keywords in C programming. Keywords in C Programming auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while Description of all Keywords in C auto The auto keyword declares automatic variables. For example: auto int var1; This statement suggests that  var1  is a variable of storage class auto and type int. Variables declared within function bodies are automatic by default. They are recreated each time a function is executed. Since, automatic variables are local to a function, they are also called local variables.  break and continue The break statement makes program jump out of the innermost enclosing loop (while, do, for or switch statements) explicitly. The continue statement skips the certain state...