Posts

Showing posts from September, 2020

If Statements in C

Image
  Decision Making/Control Statements In C Introduction Sometimes, while writing code, programmer has to take decision like, which statements or block of code to be executed and which statements or block of code to be skipped during execution. Such kind of decisions programmer can take using Decision Making Statements in C. for example if user age is above or equal to 18, user will be eligible for voting. if account balance is below minimum, user cannot withdraw money. user having multiple options and one of option has to be executed. and so on.... So, these kind of conditions decides flow of program. Decision Making Statements in C can be divided into following types 1. if statement 2. switch case statement 3. Conditional/Ternary Operator 4. goto Statement. In this Article we will see if Statements in c if Statement in C if statements are divided into following types 1. Simple if 2. if else statement 3. Nested if else statement 4. if else ladder 1. Simple if Statement : Simple...

Data Types in C

Image
 Data Types In C Introduction Type of data play very important role in Programming.  For Example: You might have filled Interactive forms on web like, Enter Your Name : Sachin Enter Your Salary : 45000.00 Enter Your Age : 30 Enter Gender : M Enter Your Phone Number : 9922970696 and so on.... In this example . . .  "Sachin" is String (Sequence of Characters/Array of Characters) 45000.00 is Real Constant, 30 is Decimal Constant, M is Single Character Constant, 9922970696 is decimal Constant. Now, to use this kind of data in programs we must have to specify Type of Data before its use. This we can do with use of Data Types in C. Data Types In C The question here is when to use Data Types. . . ? Data Types can be used while declaring Variables , Functions and so on. Variables create memory space required to store data of specific type, for example if you create integer type variable like, int num; num will get occupy with 4 Bytes of memory, now these 4 bytes can be used to st...