0% found this document useful (0 votes)
24 views13 pages

Features of C Programming Language

Uploaded by

vibhashiths447
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views13 pages

Features of C Programming Language

Uploaded by

vibhashiths447
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Features of C

Programming Language
C is a procedural programming language initially developed by
Dennis Ritchie in 1972 as a system programming language to write
operating systems. Its low-level memory access, simple keywords,
and clean style make it ideal for system programming like
operating system or compiler development.
Key Features of C Language

Procedural Language Fast and Efficient Modularity


C follows step-by-step predefined C provides direct hardware C code can be stored in libraries for
instructions. Programs may contain manipulation, making it faster than future use, with its power held in
multiple functions to perform higher-level languages like Java or these reusable components.
specific tasks. Python.
More Essential C Features
Statically Typed Rich Built-in Operators

Variable types are checked during compilation, not at Offers diverse operators for writing complex or simplified
runtime. Programmers must specify variable types when programs.
coding.
General-Purpose Robust Libraries

Used in various applications from operating systems Comprehensive functions help even beginners code with ease.
(Windows, Linux, iOS) to databases (PostgreSQL, MySQL).
C Language Advantages
Middle-Level Language Portability Easy to Extend
Combines capabilities of Programs written in C can run Existing C programs can be
assembly language with and compile on different enhanced with additional
features of high-level systems with minimal or no features and operations.
languages. changes.
C Variables: Fundamentals
A variable in C is a named memory location used to store and access data. It allows us to use memory without
memorizing exact addresses.

Declaration Initialization Usage


Specify data type and name Assign initial value Access or modify value

int num; num = 3; printf("%d", num);


Variable Naming Rules
Allowed Characters
Must only contain letters, digits, and underscores.

First Character
Must start with an alphabet or underscore, never with a digit.

No Spaces
White spaces are not allowed within variable names.

No Keywords
Cannot use reserved words or keywords as variable names.
Working with Variables
Declaration & Initialization Accessing & Changing Values

int num; // Declarationnum = 3; // #include int main() { int n = 3;


Initialization// Or combined:int num = 3; printf("%d\n", n); // Access n = 22;
// Change printf("%d", n); //
Access return 0;}

Variables act as substitutes for their values in expressions: int sum = a + b; works the same as int sum = 20 + 40;
C Format Specifiers
Format specifiers are used with printf() and scanf() to define the type of data being processed.

Common Specifiers Extended Types Special Formats


• %d - Signed integer • %lf - Double • %x - Hexadecimal
• %f - Float • %Lf - Long double • %o - Octal
• %c - Character • %ld - Long integer • %p - Pointer
• %s - String • %lld - Long long • %% - Percent sign
Basic Output in C
The printf() function outputs formatted text to the console screen.

printf("formatted_string", variables/values);

Examples:

#include int main() { // Simple text printf("Hello


World"); // With variables int age = 25; printf("Age
is: %d\n", age); return 0;}
Basic Input in C
The scanf() function reads Example:
user input from the console:
#include int main()
scanf("formatted_strin { int age;
g", &variables); printf("Enter your
age: "); scanf("%d",
Note the & operator that &age); printf("Age is:
provides the address where %d\n", age); return
input will be stored. 0;}

You might also like