Skip to main content

Posts

C – Data Types

C data types are defined as the data storage format that a variable can store a data to perform a specific operation. Data types are used to define a variable before to use in a program. Size of variable, constant and array are determined by data types. C – data types: There are four data types in C language. They are, Types Data Types Basic data types int, char, float, double Enumeration data type enum Derived data type pointer, array, structure, union Void data type void 1. Basic data types in C language: 1.1. Integer data type: Integer data type allows a variable to store numeric values. “int” keyword is used to refer integer data type. The storage size of int data type is 2 or 4 or 8 byte. It varies depend upon the processor in the CPU that we use.  If we are using 16 bit processor, 2 byte  (16 bit) of memory will be allocated for int data type. Like wise,
Recent posts

C – printf and scanf

printf() and scanf() functions are inbuilt library functions in C programming language which are available in C library by default. These functions are declared and related macros are defined in “stdio.h” which is a header file in C language. We have to include “stdio.h” file as shown in below C program to make use of these printf() and scanf() library functions in C language. 1. printf() function in C language: In C programming language, printf() function is used to print the “character, string, float, integer, octal and hexadecimal values” onto the output screen. We use printf() function with %d  format specifier to display the value of an integer variable. Similarly  %c  is used to display character,  %f  for float variable,  %s  for string variable,  %lf  for double and  %x  for hexadecimal variable. To generate a newline,we use “\n” in C printf() statement. Note: C language is case se

C – Language History

The C programming language is a structure oriented programming language, developed at Bell Laboratories in 1972 by Dennis Ritchie C programming language features were derived from an earlier language called “B” (Basic Combined Programming Language – BCPL) C language was invented for implementing UNIX operating system In 1978, Dennis Ritchie and Brian Kernighan published the first edition “The C Programming Language” and commonly known as K&R C In 1983, the American National Standards Institute (ANSI) established a committee to provide a modern, comprehensive definition of C. The resulting definition, the ANSI standard, or “ANSI C”, was completed late 1988. C programming language standards: C89/C90 standard – First standardized specification for C language was developed by the American National Standards Institute in 1989. C89 and C90 standards refer to the same programming language. C99

C – Programming Basics

If you are looking for C programs, please click here “C programs”. This C programming basics section explains a simple “Hello World” C program. Also, it covers below basic topics as well, which are to be known by any C programmer before writing a C program. C programming basic commands to write a C program A simple C program with output and explanation Steps to write C programs and get the output Creation, Compilation and Execution of a C program * How to install C compiler and IDE tool to run C programming codes Basic structure of a C program * Example C program to compare all the sections * Description for each section of the C program C programs ( Click here for more C programs )  with definition and output – C program for Prime number, Factorial, Fibonacci series, Palindrome, Swapping 2 numbers with and without temp variable, sample calculator program and sample bank application program

C programming

Include stdio.h header file in your program. C programming is small and cannot do much by itself. You need to use libraries that are necessary to run the program. The stdio.h is a header file and C compiler knows the location of that file. To use the file, you need to include it in your program using #include preprocessor. Why do you need stdio.h file in this program? In this program, we have used printf() function which displays the text inside the quotation mark. Since printf() is defined in stdio.h , you need to include stdio.h . The main() function In C programming, the code execution begins from the start of main() function (doesn’t matter if main() isn’t located at the beginning). The code inside the curly braces { } is the body of main() function. The main() function is mandatory in every C program. int main() { } This program doesn’t do anything but, it’s a valid C program. The printf() function The printf() is a library function that sends

“Hello, World!” program?

“Hello, World!” is a simple program that displays “Hello, World!” on the screen. Since, it’s a very simple program, it is used to illustrate the basic syntax of any programming language. This program is often used to introduce programming language to a beginner. So, let’s get started. #include <stdio.h> int main () { printf ( "Hello, World!\n" ); return 0 ; }

Learn C Programming

Learn C Programming      The Definitive Guide C is a powerful general-purpose programming language. It is fast, portable and available in all platforms. If you are new to programming, C is a good choice to start your programming journey. This is a comprehensive guide on how to get started in C programming language, why you should learn it and how you can learn it. What is C (Programming Language)? - The Basics Before getting started with C programming, lets get familiarized with the language first. C is a general-purpose programming language used for wide range of applications from Operating systems like Windows and iOS to software that is used for creating 3D movies. C programming is highly efficient. That’s the main reason why it’s very popular despite being more than 40 years old. Standard C programs are portable. The source code written in one system works in another operating system without any change. As mentioned,