Posts

Showing posts with the label C tutorial

Types of Operator in C Programming Notes

In C programming there are several operators are there those are, arithmetic operator, assignment, increment , decrement, logical, conditional, comma, size of , bitwise and others. So get all types of operator in C Programming notes in simple and understandable words. An operator is a symbol that tells the compiler to perform certain mathematical or logical manipulations. In this article, I will be sharing different types of Operator in C Programming Notes . Types of Operators in C Language An operator is a symbol that tells the compiler to perform certain mathematical or logical manipulations.  C operators can be classified as 1. Arithmetic operators 2. Relational operators 3. Logical operators 4. Assignment operators 5. Increment or Decrement operators 6. Conditional operator 7. Bit wise operators 8. Special operators Increment and Decrement operators in C The Unary operator ++, --, is used as increment and decrement which acts upon single operand. Increment operator increases th...

Top 4 Operators in C Language with Examples

Operator in C programming is a symbol use to perform some operation on variables, operands or with the constant. Some operator required 2 operand to perform operation or Some required single operation. Several operators are there those are, arithmetic operator, assignment, increment , decrement, logical, conditional, comma, size of , bitwise and others. In this article, I will be sharing different types of Operator in C with examples. Types of Operators in C Language An operator is a symbol that tells the compiler to perform certain mathematical or logical manipulations.  C operators can be classified as 1. Arithmetic operators 2. Relational operators 3. Logical operators 4. Assignment operators 5. Increment or Decrement operators 6. Conditional operator 7. Bit wise operators 8. Special operators ARITHMETIC OPERATORS IN C All basic arithmetic operators are present in C. +  add - subtract * multiplication / division % modulo division(remainder) An arithmetic operation involvin...

Constants in C Language with examples explain

Constant is a any value that cannot be changed during program execution. In any Language Constants are very important, so to know Constants in C Language with examples read complete article.  In C, any number, single character, or character string is known as a constant. A constant is an entity that doesn’t change whereas a variable is an entity that may change. For example, the number 50 represents a constant integer value.  The character string "Programming in C is fun.\n" is an example of a constant character string. C constants can be divided into two major categories:  Primary constants   − Integer, float, and character are called as Primary constants. Secondary constants  − Array, structures, pointers, Enum, etc., called as secondary constants. List of Constants in C Language There are different types of constants in C programming. Decimal Constant 10, 20, 450 etc. Real or Floating-point Constant 10.3, 20.2, 450.6 etc. Octal Constant 021, 033, 046 e...

Data Types in C with examples and Size of Data Types

Data Types in C is very important concept to understand along with the size of Data Types in C. So In this article, I will be providing an information about  Data Types in C with examples and Size of Data Types . Data types refer to an extensive system used for declaring variables or functions of different types before its use. To represent different types of data in C program we need different data types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted. The value of a variable can be changed any time. C supports four different classes of data types namely: Types of Data Types in C Types Data Types Basic Data Type int, char, float, double Derived Data Type array, pointer, structure, union Enumeration Data Type enum Void Data Type void BASIC DATA TYPES in C All arithmetic operations such as Addition , subtraction etc are possible on basic data types. E.g.:       int a,b;    ...

Basic Structure of C Program with example explain

C program follows some basic Structure, So we will learn Basic Structure of C Program with example and with proper explanation. Basic Structure of C Program The program written in C language follows this basic structure. The sequence of sections should be as they are in the basic structure. A C program should have one or more sections but the sequence of sections is to be followed: 1. Documentation section  2. Linking section  3. Definition section  4. Global declaration section  5. Main function section  6. Sub program or function section In now let us discuss in detail. DOCUMENTATION SECTION DOCUMENTATION SECTION is used to document the use of logic or reasons in your program. It can be used to write the program's objective, developer and logic details.  The documentation is done in C language with /* and */ . Whatever is written between these two are called comments. LINKING SECTION This section tells the compiler to link the certain occurrences of...

Become App Developer Beginners Guide 2020

Image
Become App Developer Beginners Guide 2020 Become App Developer Beginners Guide 2020, Want to become Android or App Developer then you are in the right article. We provide Basic to Advanced App Developer Beginners Guide. Many Students want to become App Developers due to its trend in this decade. So to learn Mobile App Development especially Android App Development Candidate has to learn some Programming Languages and want some resources from where they can start and go from zero to hero. So in this Article about –Become App Developer Beginners Guide in 2020 we listed Resources for Learning App Development and Languages to know to become an Android App Developer. Therefore, If you want to become or have an interest in Mobile App Development then go through complete Article Nowadays Students are well-known to  What is App Development? But don't know how to get started? So let me tell you there are many Platforms to Start. Become App Developer Beginners ...

Increment and Decrement Operator in C

Image
Increment and decrement operators in C The increment operator (++) increments the value of its operand by 1.      x = 10;      x++;  // increments the value of x by 1.  So, the value of x is 11. The decrement operator(--) decrements the value of its operand by 1;      x = 10;      x--;  // decrements the value of x by 1;  So, the value of x is 9.   Both the operators can be placed before or after the operand as shown above and they can be applied on primitive data types like char, int, float, double & they can also be used on pointers and enums. Difference between postfix increment and prefix increment: Example 1: int a, b = 10; a = b++; Value of a is 10 Value of b is 11 In the above expression, the value of b is assigned to a first.  Then, 1 is added to the value of b. Example 2: int a, b = 10 a = ++b; Value of a is 11 Value of b is 11 Here, the value of b is i...

printf() and scanf() functions in C Programming Examples

Image
printf()  and scanf() functions printf() function: It prints the given data on the output screen. Scanf() function: It is used to read input from the keyboard. Format Specifier of Each: printf()- printf("%d", 10);              - prints 10 on the output screen printf("%f", num);            - prints the float value in variable num on the output screen printf("%d and %d", a, b); - prints the value of the integers a and b on the output screen. Suppose, if the value of a is 10 and the value of b is 20.  Then, the output for the below statement would be 10 and 20 printf("%d and %d", a, b); scanf()- Format specifier can be any of the following %u  - unsigned int %d  - int %x  - hexadecimal %o  - octal %f  - float %lf - double %c  - char %s  - string scanf("%d", &v1); - inputs integer value scanf("%x", &v2); - inputs ...

Arithmetic operators in c progamming with example

Image
Arithmetic operators in c Arithmetic operators are used to perform arithmetic operations like addition, subtraction, multiplication, division and modulo. Example OUTPUT

Assignment operators in C Language with examples

Image
Assignment operators in C An assignment operator is the operator used to assign a new value to a variable, property, event or indexer element in C# programming language. Assignment operators can also be used for logical operations such as bitwise logical operations or operations on integral  Operands and boolean operands. #include <stdio.h> int main() {       int a, b, c, d, e;  // variable declaration       a = b = c = d = e = 100;  // assign 100 to a, b, c, d & e         a += 10; // a = a + 10       printf("Value of a is %d\n", a);         b -= 10; // b = b - 10       printf("Value of b is %d\n", b);         c *= 10; // c = c * 10       printf("Value of c is %d\n", c);         d /= 10; // d = d / 10       printf("Value of d is %d\n", d); ...

Data Type in C

Image
Data types and format specifiers in c Basic data types available in C programming language are signed char, unsigned char, char, short int, unsigned short int, int, unsigned int, long int, unsigned long int, long long int, unsigned long long int, float, double, long double.  Here, we will see basic data types, their size and range.

What are identifiers in c?

What are identifiers in c? An identifier is a set of characters used to name variables, functions, macros and enums. Valid characters in C language identifiers: Alpha characters[a-z][A-Z] Decimal numbers[0-9] Underscore (_) Dollar symbol($) Valid and invalid identifiers in C language: Numeric character should not be used as the first character of identifer.  Space is not allowed in the name of the identifier.  Below are some of the invalid identifier. Example: 9num, 1val, #val Example of identifiers in C   #include <stdio.h> #define $pi 3.14  // pi is an identifer void _calc_area(int radius) { // calc_area and radius are identifiers       printf("Area of circle: %f\n", $pi * radius * radius);       return; }   int main() {       int $, _, radius; // $, _, radius are identifiers       _ = 5;       $ = 10;       radius = 10; ...

All Keywords in C Programming Language

Image
Keywords in C Programming Language Keywords are those words whose meaning is already defined by Compiler Cannot be used as Variable Name There are 32 Keywords in C C Keywords are also called as Reserved words . Example Of Keyword  #include <stdio.h> void main() {       int i = 0;       const char ch = 'a';       // value of ch is a.  So, case 'a' will be executed       switch (ch) {               case 'a':                       // prints hello world for 3 times                       for (i = 0; i < 3; i++)                               printf("Hello world!!\n");                       break; ...

Tokens In C Programming

What is a token in c language? Token is the basic fundamental unit that makes up C source code after pre-processing.  There are six types of token in C. Keywords: Keywords are special words that are used to give a special meaning to the program and can’t be used as variable and constant. They are basically a sequence of characters that have fixed to mean for example break, for, while, do-while, do, if, int, long, char. Identifiers: Identifiers are the sequence of alphabets and digit, but keyword should not be used as an identifier. Constants: The quantity which does not change during the execution of a program is known as constant. There are types of constant. Variables: Variables are used to give the name and allocate memory space. An entity that may vary data during execution. For example, sum, area, a, b, age, city. String: String is a collection of more than one character. For example, “RAM”, “Meerut”, “Star” String is represented by a pair of double quotes. Ope...

Structure of a c program

Image
Documentation section : The documentation section consists of a set of comment lines giving the name of the program, the author and other details, which the programmer would like to use later. Link section : The link section provides instructions to the compiler to link functions from the system library. Definition section : The definition section defines all symbolic constants. Global declaration section : There are some variables that are used in more than one function. Such variables are called global variables and are declared in the global declaration section that is outside of all the functions. This section also declares all the user-defined functions. main () function section : Every C program must have one main function section. This section contains two parts; declaration part and executable partDeclaration part : The declaration part declares all the variables used in the executable part.Executable part : There is at least one statement in the executabl...

Hello World - First Program

What is Program ? Program is a set of instructions which can be executed in a specific sequence to get the desired output. Hello World Program is the First Program- hello.c Program: #include <stdio.h> /* Header file */ main() { /* Program execution starts here */ printf ("Hello world"); /* Built-in function - printf() */ return 0; }   1.Comments should be enclosed within /* */ and they won’t get executed. 2.Program execution always start from the main function. 3.printf() is a library function available in “stdio.h” header file. It is used to format and print data. 4.Header file contains the built-in functions and pre-defined variables. ALSo hello.c is the file containing the above program.  Below command is used to compile the c program. gcc <C File Name>  i.e. gcc hello.c

Introduction to C Programming

Founder Of C Programming ~~ Dennis Ritchie Some Introduction to C Programming C language was developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Laboratories.  C was initially designed to develop system software.  Because of its simplicity, flexibility and portability, it is also used to develop application software.  Most of the features in C are derived from "B" programming language.  That is the reason why the new language was named as "C". C is a high level language but it lacks features like garbage collection, object orientation which are usually available in high-level languages. C is a structured programming language.  Because, C provides many features like functions, if statements, loops, blocks etc. Appication Of It Used to develop firmware for micro controllers, operating system, device drivers etc. Major programming languages like PHP, Perl , Python etc. are written in C Used to develop application softwares lik...