C – Page 4 – POFTUT

Category: C

0

C – File Operations, Open, Write and Close Files

[rps-include post=6557] While learning C programming language one of the most exciting part is writing and reading a file. Because this operations creates something on the operating system we can see which is different from other examples. In this tutorial we will look different aspects of file operations. stdio.h Library As  we know C provides different type of features with libraries. Input and output related features are provided by the...

0

C – Union

[rps-include post=6557] Union is a data type used to store different type of variables. Union is very similar to the struct but have some differences those have explained below. Union can contain int,char,float,… etc. in a single block. One union can contain single set of data at a time. Defining Unions Defining union is very similar to struct. We will use union statement. After union statement we will put union tag. After...

0

C Header Files and Include

[rps-include post=6557] C header files used to load builtin or third party libraries. Header files provides information about the library, functions, variables, structures etc. provided library. Include In order to load library header files we use #include preprocessor. #include preprocessor will load related library definitions before source code is expanded and compiled. All related definitions are inserted into the source code automatically. Include syntax is very simple like below. We write #include and...

0

C Functions – Create and Run with Examples

[rps-include post=6557] Functions are a grouping statements to perform operations. Why we group statements in a function? While developing applications same operations can be done thousand of times and writing same code a lot of time is not efficient and exiting. Also changing single statement will require all of the copied statements to change. Every C applications have at least one function which is the entrance function named main() . Below we...

0

C – Arrays

[rps-include post=6557] Arrays are different from primitive types like integer,chars. Arrays provides fixed length sequential data. All of the data is same type. We can think array like a same type list. Arrays uses indexes to specify specific item in array. Declaring Arrays There is two must do to define array. One is the type of the array and second is length of the array. Basic syntax of defining array...

0

C For Loop and Iteration

[rps-include post=6557] For loop is generally used for specified arrays or similar array like lists. For enumerates over given way and checks the condition whether it is met or not. Here is For syntax.

Initialize fired one time at the start of for loop and generally used to set some values. Condition is checked in every turn of loop and if condition is met for loop is ended. Increment is run is every turn of loop...

0

C – While Loops

[rps-include post=6557] Loops are used to loop and iterate through sequential data or similar serial output. Sequential data will be generally an array. For example to search in a array for a specific value while loop can be used. We will look 3 main loop mechanism provided by C programming language. While While runs repeatedly if given condition is true. Here is the syntax of while .

In while...

0

C – If Else , Switch, Decision Making

[rps-include post=6557] Conditions or Decisions making is one of the most important aspect of programming languages. Actual programming logic is implemented in the decisions. According to decisions the application will be branched and expected results or operations will be accomplished. There are 3 main decision making mechanisms. We will look in details below. If The syntax of if is like below in C programming language.

with if(boolean_expression) if boolean_expression is true code...

0

C Operators – Logical, Arithmetic, Relational

[rps-include post=6557] Operators are leg and arm of the C programming language. A lot of operations done with operators. Operators used to assign, sum, subtract, multiply, divide, remainder, increment, decrement … operations. We will look all of these operations in this chapter. Operators can be grouped like below. Arithmetic Relational Logical Bitwise Assignment Misc Arithmetic Arithmetic is most popular usage of operators. Add, Subtract, Multiply, Divide, Modulus, Increment, Decrement operations...

0

C Constants and Define Preprocessor

[rps-include post=6557] Up to now we have worked with variables. As its names states variables values may change in the flow of application. Variables changes by adding, removing, subtracting etc. This may be ideal solution for most of time but how can we avoid it if we need constant values. Because if we want to define Pi number and do not want to change it as Pi is fixed number...

Enjoy this blog? Please spread the word :)