C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
JavaTpoint share a presentation of C Programming language for beginners and professionals. now in this slideshare you will be learned basics of c programming language, what is c programming language, history of c programming, installing turbo c, features of c programming language, datatypes of c language, operaters in c, control statement of c language, c language functions, c array, pointer in c programming, and structure and union.
Contains C programming tutorial for beginners with lot of examples explained. This tutorial contains each and every feature of C programming that will help you. C programming tutorial covering basic C Programming examples, data types, functions, loops, arrays, pointers, etc.
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
JavaTpoint share a presentation of C Programming language for beginners and professionals. now in this slideshare you will be learned basics of c programming language, what is c programming language, history of c programming, installing turbo c, features of c programming language, datatypes of c language, operaters in c, control statement of c language, c language functions, c array, pointer in c programming, and structure and union.
Contains C programming tutorial for beginners with lot of examples explained. This tutorial contains each and every feature of C programming that will help you. C programming tutorial covering basic C Programming examples, data types, functions, loops, arrays, pointers, etc.
Download this Presentation for free from www.ecti.co.in/downloads.html
No SIGN UP REQUIRED.
C Programming Training PPTs / PDFs for free.
Download free C Programming study material. Learn C Programming for free in 2 hours.
E2MATRIX Research Lab
Opp Phagwara Bus Stand, Backside Axis Bank,
Parmar Complex, Phagwara Punjab (India).
Contact : +91 9041262727
web: www.e2matrix.com -- email: support@e2matrix.com
Simulation and Synthesis
Modules and Primitives
Styles
Structural Descriptions
Language Conventions
Data Types
Delay
Behavioral Constructs
Compiler Directives
Simulation and Testbenches
Simulation tools typically accept full set of Verilog language constructs
Some language constructs and their use in a Verilog description make simulation efficient and are ignored by synthesis tools
Synthesis tools typically accept only a subset of the full Verilog language constructs
In this presentation, Verilog language constructs not supported in Synopsys FPGA Express are in red italics
There are other restrictions not detailed here, see [2].
Programming is hard. Programming correct C and C++ is particularly hard. Indeed, both in C and certainly in C++, it is uncommon to see a screenful containing only well defined and conforming code.Why do professional programmers write code like this? Because most programmers do not have a deep understanding of the language they are using.While they sometimes know that certain things are undefined or unspecified, they often do not know why it is so. In these slides we will study small code snippets in C and C++, and use them to discuss the fundamental building blocks, limitations and underlying design philosophies of these wonderful but dangerous programming languages.
This content has a CC license. Feel free to use it for whatever you want. You may download the original PDF file from: http://www.pvv.org/~oma/DeepC_slides_oct2012.pdf
This slide covers fundamentals about C, its environment and usage. It comprises the basic information that a C programmer should have alongwith the basic program example.
Download this Presentation for free from www.ecti.co.in/downloads.html
No SIGN UP REQUIRED.
C Programming Training PPTs / PDFs for free.
Download free C Programming study material. Learn C Programming for free in 2 hours.
E2MATRIX Research Lab
Opp Phagwara Bus Stand, Backside Axis Bank,
Parmar Complex, Phagwara Punjab (India).
Contact : +91 9041262727
web: www.e2matrix.com -- email: support@e2matrix.com
Simulation and Synthesis
Modules and Primitives
Styles
Structural Descriptions
Language Conventions
Data Types
Delay
Behavioral Constructs
Compiler Directives
Simulation and Testbenches
Simulation tools typically accept full set of Verilog language constructs
Some language constructs and their use in a Verilog description make simulation efficient and are ignored by synthesis tools
Synthesis tools typically accept only a subset of the full Verilog language constructs
In this presentation, Verilog language constructs not supported in Synopsys FPGA Express are in red italics
There are other restrictions not detailed here, see [2].
Programming is hard. Programming correct C and C++ is particularly hard. Indeed, both in C and certainly in C++, it is uncommon to see a screenful containing only well defined and conforming code.Why do professional programmers write code like this? Because most programmers do not have a deep understanding of the language they are using.While they sometimes know that certain things are undefined or unspecified, they often do not know why it is so. In these slides we will study small code snippets in C and C++, and use them to discuss the fundamental building blocks, limitations and underlying design philosophies of these wonderful but dangerous programming languages.
This content has a CC license. Feel free to use it for whatever you want. You may download the original PDF file from: http://www.pvv.org/~oma/DeepC_slides_oct2012.pdf
This slide covers fundamentals about C, its environment and usage. It comprises the basic information that a C programmer should have alongwith the basic program example.
Programming Fundamentals Functions in C and typesimtiazalijoono
Programming Fundamentals
Functions in C
Lecture Outline
• Functions
• Function declaration
• Function call
• Function definition
– Passing arguments to function
1) Passing constants
2) Passing variables
– Pass by value
– Returning values from functions
• Preprocessor directives
• Local and external variables
A computer is an electronic device used to process data, converting the data into information that is useful to people.
A computer is a system made of two major components:
hardware and software.
The hardware is the physical equipment.
The software is the collection of programs (instruction) that allow the hardware to do the job.
Fundamental of C Programming Language and Basic Input/Output Functionimtiazalijoono
Fundamental of C Programming Language
and
Basic Input/Output Function
contents
C Development Environment
C Program Structure
Basic Data Types
Input/Output function
Common Programming Error
COMP 2103X1 Assignment 2Due Thursday, January 26 by 700 PM.docxdonnajames55
COMP 2103X1 Assignment 2
Due Thursday, January 26 by 7:00 PM
General information about assignments (important!):
http://cs.acadiau.ca/~jdiamond/comp2103/assignments/General-info.html
Information on passing in assignments:
http://cs.acadiau.ca/~jdiamond/comp2103/assignments/Pass-in-info.html
Information on coding style:
http://cs.acadiau.ca/~jdiamond/comp2103/assignments/C-coding-style-notes
[1] A filter program is a program which reads its input from “standard input” (“stdin”) and writes
its output to “standard output” (“stdout”). Filter programs are useful because they make it easy
to combine the functions they provide to solve more complex problems using the standard shell
facilities. Filter programs are also nice to write, because the programmer doesn’t have to worry
about writing code to open and close files, nor does the programmer have to worry about dealing
with related error conditions. In some respects, filter programs are truly “win-win”.
Write a filter program which uses getchar() to read in characters from stdin, continuing until
end of file (read the man page and/or textbook to see the details on getchar(), or, heaven forbid,
review the class slides). Your program must count the number of occurrences of each character in
the input. After having read all of the input, it outputs a table similar to the one below which, for
each character seen at least once, lists the total number of times that character was seen as well as
its relative frequency (expressed as a percentage). Note that the characters \n, \r, \t, \0, \a, \b,
\f, and \v (see man ascii) must be displayed with the appropriate “escape sequence”. Ordinary
printable characters must be output as themselves. Non-printable characters (see man isprint)
must be printed with their three-digit octal code (see man printf).
You can get input into a filter program (a2p1 in this case) in three ways:
(a) “pipe” data from another program into it, like
$ echo blah blah | a2p1
(b) “redirect” the contents of a file into the program, like
$ a2p1 < some-file
(c) type at the keyboard, and (eventually) type ^D (control-d) at the beginning of a line to
signify end of file.
Your output must look like the following, for this sample case:
$ echo ^Aboo | a2p1
Char Count Frequency
--------------------------
001 1 20.00%
\n 1 20.00%
b 1 20.00%
o 2 40.00%
Note: in the above examples, and from now on in this course’s assignments, text in red is text that
the human types, and a “$" at the beginning of a line like that represents the shell prompt.
1
http://cs.acadiau.ca/~jdiamond/comp2103/assignments/General-info.html
http://cs.acadiau.ca/~jdiamond/comp2103/assignments/Pass-in-info.html
http://cs.acadiau.ca/~jdiamond/comp2103/assignments/C-coding-style-notes
Note that I entered a ^A (control-a, not the circumflex character followed by the capital A) by
typing ^V^A. The ^V tells your shell that you want it to interpret the next character literally, rather
than to use any special meani.
Let's dive deeper into the world of ODC! Ricardo Alves (OutSystems) will join us to tell all about the new Data Fabric. After that, Sezen de Bruijn (OutSystems) will get into the details on how to best design a sturdy architecture within ODC.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
The field of Information retrieval (IR) is currently undergoing a transformative shift, at least partly due to the emerging applications of generative AI to information access. In this talk, we will deliberate on the sociotechnical implications of generative AI for information access. We will argue that there is both a critical necessity and an exciting opportunity for the IR community to re-center our research agendas on societal needs while dismantling the artificial separation between the work on fairness, accountability, transparency, and ethics in IR and the rest of IR research. Instead of adopting a reactionary strategy of trying to mitigate potential social harms from emerging technologies, the community should aim to proactively set the research agenda for the kinds of systems we should build inspired by diverse explicitly stated sociotechnical imaginaries. The sociotechnical imaginaries that underpin the design and development of information access technologies needs to be explicitly articulated, and we need to develop theories of change in context of these diverse perspectives. Our guiding future imaginaries must be informed by other academic fields, such as democratic theory and critical theory, and should be co-developed with social science scholars, legal scholars, civil rights and social justice activists, and artists, among others.
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Unit1 jwfiles
1. Computer -- Hardware
Input Output
Key board Storage Program Storage Area
Storage Monitor
Area Area
Mouse Working Storage Area Printer
Input Devices Output Devices
Primary or Main Memory (RAM)
Register 1
Register 2
……
……
Arithmetic
Register N and
Logic Unit
Secondary Storage Devices
Micro Processor
2. Algorithm: Step by step procedure of solving a particular problem.
Pseudo code: Artificial informal language used to develop algorithms.
Flow chart: Graphical representation of an algorithm.
Algorithm to find whether a number even or odd:
Step1: Begin Step1: START
Step2: Take a number Step2: Read num
Step3: if the number is divisible by2 then Step3: if(num%2=0) then
print that number is even print num is even
otherwise print that number is odd otherwise
print num is odd
Step4: End Step4: STOP
(Algorithm in natural language) (Algorithm by using pseudo code)
#include<stdio.h> start
#include<conio.h> Flow chart:
main() read num
{
int num;
printf(“Enter any number”); If num No
Yes
scanf(“%d”,&num); %2=0
if(num%2==0)
printf(“%d is even”,num);
else print num print num
printf(%d is odd”,num);
is even is odd
}
(Program in C language) stop
3. Flow chart symbols
Oval Terminal
Parallegram Input/output
Rectangle Process
Document Hard copy
Diamond Decision
Circle Connector
Double sided Rectangle Sub program
Hexagon Iteration
Trapezoid Manual Operation
Cylinder Magnetic Disk Storage
4. Machine Language – Assembly Language – High-Level Language
1 00000000 00000100 0000000000000000 1 entry main,^m<r2>
2 01011110 00001100 11000010 0000000000000010 2 sub12 #12,sp
3 11101111 00010110 0000000000000101 3 jsb C$MAIN_ARGS
4 11101111 10111110 0000000000001011 4 moveb $CHAR_STRING_CON
5 11111000 10101101 11011111 0000000000010010 5
6 01100010 11011111 0000000000010101 6 pusha1 -8(fp)
7 11101111 00000010 11111011 0000000000010111 7 pusha1 (r2)
8 11110100 10101101 11011111 0000000000011110 8 calls #2,SCANF
9 00000011 10100010 11011111 0000000000100001 9 pusha1 -12(fp)
10 11101111 00000010 11011111 0000000000100100 10 pusha1 3(r2)
11 01111110 11110100 10101101 11 calls #2,SCANF
12 11111000 10101110 11000101 0000000000101011 12 mull3 -8(fp),-12(fp),-
13 00000110 10100010 11111011 0000000000110001 13 pusha 6(fp)
14 11101111 00000010 11111011 0000000000110100 14 calls #2,PRINTF
15 01010000 11010100 0000000000111011 15 clrl r0
16 00000100 0000000000111101 16 ret
1 #include<stdio.h>
2 int main(void) The only language the computer can understand is machine
3 { language (binary language).
4 int n1, n2,product;
5 printf(“Enter two numbers : “); A high level language is an English like language where one
6 scanf(“%d %d”,&n1,&n2);
instruction typically translates into a series of machine-
7 product = n1 * n2;
8 printf(“%d”,product);
language instructions.
9 return 0;
1 } A low level language corresponds closely to machine code so
0 that a single low-level language instruction translates to a
single machine language instruction.
5. Structure of C program
/*Program to find
Documentation Section
area and perimeter of Circle */
#include<stdio.h> Linkage Section
#define PI 3.1415 Definition Section
float radius;
float area(); Global Declaration Section
float perimeter();
int main()
{
float a, p; Main Function Section
printf(“Enter radius : “);
scanf(“%f”,&radius); Local Declaration Part
a = area(); Executable Code Part
p = perimeter();
printf(“Area of Circle : %f”,a);
printf(“Perimeter : %f”,p);
}
float area()
Sub Program Section
{
return (PI * radius * radius);
Function1()
}
Function2()
float perimeter()
……………
{
FunctionN()
return (2 * PI * radius);
}
6. Program Development Steps
1)Statement of Problem 4.a)Compilation
a) Working with existing system and using proper Translate the program into machine code. This
questionnaire, the problem should be explained process is called as Compilation. Syntactic errors are
clearly. found quickly at the time of compiling the program.
b) What inputs are available, outputs are required These errors occur due to the usage of wrong
and what is needed for creating workable solution syntaxes for the statements.
should be understood clearly. Eg: x=a*y+b
2)Analysis There is a syntax error in this statement, since, each
a) The method of solutions to solve the problem can and every statement in C language ends with a
be identified. semicolon (;).
b) We also judge that which method gives best
results among different methods of solution. 4.b)Execution
3)Designing The next step is Program execution. In this phase, we
a) Algorithms and flow charts will be prepared. may encounter two types of errors.
b) Keep focus on data, architecture, user interfaces Runtime Errors: these errors occur during the
and program components. execution of the program and terminates the program
abnormally.
4)Implementation
The algorithms and flow charts developed in the Logical Errors: these errors occur due to incorrect
usage of the instructions in the program. These errors
previous steps are converted into actual programs in
are neither detected during compilation or execution
the high level languages like C.
nor cause any stoppage to the program execution but
produces incorrect ouz
7. Executing a C program
#include<stdio.h>
Text int main()
{ Translators are system software
Editor ……. prog1.c used to convert high-level
language program into
C-compiler compiles
machine-language code.
Compiler : Coverts the entire
010110 100 Syntax Yes source program at a time
…………….
01011 101
Errors? into object code file, and
No saves it in secondary storage
Object machine code permanently. The same
adds prog1.obj object machine code file will
Linker
be executed several times,
00101010
Executable whenever needed.
………….
01010101 machine code Interpreter : Each statement of
prog1.exe source program is translated
machine code of
library file into machine code and
Executes executed immediately.
C-Runtime
Translation and execution of
Feeds
each and every statement is
Runtime Yes
Input or Logic repeated till the end of the
Errors ? program. No object code is
saved. Translation is
repeated for every execution
Output of the source program.
8. Character Set of C-Language
Alphabets : A-Z and a-z
Digits : 0-9
Special Symbols : ~ ! @ # $ % ^ & ( ) _ - + = | { } [ ] : ; “ ‘
<>,.?/
White Spaces : space , Horizontal tab, Vertical tab, New Line
Form Feed.
C-Language Keywords(C99)
auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while
_Bool _Imaginary restrict _Complex
inline
9. C-Tokens
Tokens : The smallest individual units of a C- program are called Tokens.
Key words, Identifiers, Constants, Operators, Delimiters.
Key words : have a predefined meaning and these meanings cannot be
changed. All keywords must be written in small letters (except additional
c99 keywords).
Identifiers : names of variables, functions, structures, unions, macros, labels,
arrays etc.,
Rules for define identifiers :
a) First character must be alphabetic character or under score
b) Second character onwards alphabetic character of digit or under
score.
c) First 63 characters of an identifier are significant.
d) Cannot duplicate a key word.
e) May not have a space or any other special symbol except under
score.
f) C – language is Case-sensitive.
10. C-Tokens
Constants : fixed values that do not change during execution of a program.
Boolean constants : 0 ( false) and 1 (true)
Character constants :
only one character enclosed between two single quotes
( except escape characters ).
wide character type - wchar_t - for Unicode characters.
Integer constants : +123, -3454 , 0235 (octal value),
0x43d98 ( hexa - decimal value)
54764U, 124356578L, 124567856UL
Float constants : 0.2 , 876.345, .345623 , 23.4E+8, 47.45e+6
String Constants : “Hello world” , “Have a nice day!”
Complex Constants : real part + imaginary part * I ex : 12.3 + 3.45 * I
Operators : a symbol, which indicates an operation to be performed.
Operators are used to manipulate data in program.
Delimiters : Language Pattern of c-language uses special kind of symbols
: (colon, used for labels) ; (semicolon terminates statement ) ( ) parameter list
[ ] ( array declaration and subscript ), { } ( block statement )
# ( hash for preprocessor directive ) , (comma variable separator )
11. Data Types ( pre defined )
Type Typical Size in Bits Minimal Range
char 8 –127 to 127
unsigned char 8 0 to 255
signed char 8 –127 to 127
int 16 or 32 –32,767 to 32,767
unsigned int 16 or 32 0 to 65,535
signed int 16 or 32 Same as int
short int 16 –32,767 to 32,767
unsigned short int 16 0 to 65,535
signed short int 16 Same as short int
long int 32 –2,147,483,647 to 2,147,483,647
long long int 64 –(263) to 263 – 1 (Added by C99)
signed long int 32 Same as long int
unsigned long int 32 0 to 4,294,967,295
unsigned long long int 64 264 – 1 (Added by C99)
float 32 3.4e-38 to 3.4e+38
double 64 1.7e-308 to 1.7e+308
long double 80 3.4e-4932 to 1.1e+4932
void -- data type that not return any value
12. Conversion Specifiers
Code Format
%a Hexa decimal output in the form of 0xh.hhhhp+d(C99 only)
%s String of characters (until null zero is reached )
%c Character
%d Decimal integer
%f Floating-point numbers
%e Exponential notation floating-point numbers
%g Use the shorter of %f or %e
%u Unsigned integer
%o Octal integer
%x Hexadecimal integer
%i Signed decimal integer
%p Display a pointer
%n The associated argument must be a pointer to integer, This sepecifier causes
the number of characters written in to be stored in that integer.
%hd short integer
%ld long integer
%lf long double
%% Prints a percent sign (%)
13. Back Slash ( Escape Sequence) Characters
Code Meaning
b Backspace
f Form feed
n New line
r Carriage return
t Horizontal tab
" Double quote
' Single quote
Backslash
v Vertical tab
a Alert
? Question mark
N Octal constant (N is an octal constant)
xN Hexadecimal constant (N is a hexadecimal constant)
14. Increment and Decrement Operators
prefix increment (++a) postfix increment (a++) prefix decrement(- -a) postfix decrement (a- -)
Executes all Prefix Operations Before evaluation of expression
Evaluation of expression
Executes all Postfix Operations After evaluation of expression
and before leaving the statement
/* prefix operators */ /* prefix and postfix operators */ /* postfix operators */
#include<stdio.h> #include<stdio.h> #include<stdio.h>
int main() { int main() { int main() {
int a = 7, b = 12, c; int a = 7, b = 12, c; int a = 7, b = 12, c;
c = b * (++a) + 5 * (++a); c = b * (a++) + 5 * (++a); c = b * (a++) + 5 * (a++);
printf(“ a = %d”, a); printf(“ a = %d”, a); printf(“ a = %d”, a);
printf(“n b = %d”,b); printf(“n b = %d”,b); printf(“n b = %d”,b);
printf(“n c = %d”,c); printf(“n c = %d”,c); printf(“n c = %d”,c);
} } }
Output: Output: Output:
a=9 a=9 a=9
b = 12 b = 12 b = 12
c = 153 ( 12 * 9 + 5 * 9) c = 136 ( 12 * 8 + 5 * 8) c = 119 ( 12 * 7 + 5 * 7)
15. Bitwise Logical Operators
& -- Bitwise AND A B A&B A|B A^B ~A
1 1 1 1 0 0
| -- Bitwise OR
1 0 0 1 1 0
^ -- Bitwise XOR 0 1 0 1 1 1
~ -- Bitwise NOT 0 0 0 0 0 1
Bitwise AND Bitwise OR
A (42) : 00000000 00101010 A (42) : 00000000 00101010
B (15) : 00000000 00001111 B (15) : 00000000 00001111
----------------------------------- -----------------------------------
& (10) : 00000000 00001010 | (47) : 00000000 00101111
----------------------------------- -----------------------------------
Bitwise XOR Bitwise NOT
A (42) : 00000000 00101010 A (42) : 00000000 00101010
B (15) : 00000000 00001111 -----------------------------------
----------------------------------- ~ (-43) : 11111111 11010101
& (37) : 00000000 00100101 -----------------------------------
-----------------------------------
16. BITWISE SHIFT OPERATORS
Bitwise Left Shift ( << ) Bitwise Right Shift ( >> ) Bitwise Right Shift ( >> )
(positive values) (negetive values)
A (43) : 00000000 00101011 A (43) : 00000000 00101011 A (-44) : 11111111 11010100
----------------------------------- ----------------------------------- -----------------------------------
A << 2 : 00000000 10101100 A >> 2 : 00000000 00001010 A >> 2 : 11111111 11110101
----------------------------------- ----------------------------------- -----------------------------------
Note : Right shift operator fills the left vacant fields with ‘zeros’ for positive numbers,
with ‘ones’ for negative numbers.
Opposite TYPE CONVERSION Explicit Type Conversion
To
(casting)
Gravity
1.bool
2.char (forcible)
(forcible)
3.short int
.
4.int .
5.long int .
.
6.long long int .
.
7.float
(natural) (automatic)
8.double
9.long double
Gravity Implicit Type Conversion
(automatic)
17. Precedence and Associativity of Operators
Precdence Group Operators Associativity
(Highest to Lowest )
(param) subscript etc., ( ) [ ] –>. L R
Unary operators - + ! ~ ++ – – (type) * & sizeof R L
Multiplicative */% L R
Additive +– L R
Bitwise shift << >> L R
Relational < <= > >= L R
Equality = = != L R
Bitwise AND & L R
Bitwise exclusive OR ^ L R
Bitwise OR | L R
Logical AND && L R
Logical OR || L R
Conditional ?: R L
Assignment = += –= *= /= %= &= ^= R L
|= <<= >>=
Comma , L R
18. simple if: Entry if-else: Entry
True Test False
Test True Expression
Expression ?
?
False True Statement-block
True-block False-block
Statements Statements
Next statement
Next statement
/* check a citizen is eligible for voting */ /* print a number is even or odd */
#include<stdio.h> #include<stdio.h>
int main() int main()
{ {
int age; int number;
printf(“Enter the age : ”); printf(“Enter a number : “);
scanf(“%d”,&age); scanf(“%d”, &number);
if(age >= 18) if((number %2) == 0)
printf(“Eligible for voting…”); printf(“%d is even number.”,number);
getch(); else
} printf(“%d is odd number.”,number);
}
19. nested if…else: /* check whether a year is leap year or not */
#include<stdio.h>
Entry int main() {
int year;
Test printf("Enter the year ?");
False True
condition1 scanf("%d",&year);
? if((year %100) == 0)
Test {
False True if((year % 400) == 0)
condition2
? printf("%d is leap year.",year);
else
Statement-3 Statement-2 Statement-1 printf("%d is not leap year.",year);
} else {
if((year % 4) == 0)
printf("%d is leap year.",year);
else
Next statement
printf("%d is not leap year.",year);
}
getch();
}
20. if…else…if : /* program to print the grade of student */
#include<stdio.h>
Entry int main() {
True
int marks;
Test
condition1 Statement-1 printf("Enter marks ? ");
? scanf("%d", &marks);
False if(marks >= 75)
Test True printf("Distinction");
condition2 Statement-2 else if(marks >= 60)
? printf("First class");
False else if(marks >= 50)
Test True printf("Second class");
conditionN Statement-N
else if(marks >= 35)
?
printf("Third class");
Next statement else
printf("Failed");
}
21. switch statement : /* program to simulate a simple calculator */
#include<stdio.h>
Entry int main() {
float a,b;
switch char opr;
expression printf("Enter number1 operator number2 : ");
? scanf("%f %c %f",&a,&opr,&b);
switch(opr)
value1 value2 valueN default {
……... case '+':
printf("Sum : %f",(a + b));
associate associate associate associate break;
statement statement statement statement case '-':
printf("Difference : %f",(a - b));
break;
case '*':
printf("Product : %f",(a * b));
break;
case '/':
Exit printf("Quotient : %f",(a / b));
break;
default:
Next statement printf("Invalid Operation!");
}
}
22. Loop Statements
while – (Entry controlled ) do-while – (Exit controlled )
Entry
Entry
Test False
Condition Body of The loop
?
true Test False
Body of The loop Condition
?
Following Statement True Following Statement
/* average of 5 numbers */
/* sum of 1 to 10 numbers */
#include<stdio.h>
#include<stdio.h>
int main() {
int main() {
int count = 1;
int i = 1,sum = 0;
float x, sum = 0;
while(i<=10){
do {
sum = sum + i;
printf(“x = “);
i = i + 1;
scanf(“%f”,&x);
}
sum += x;
printf(“Total : %d “,sum);
++ count;
}
} while(count <= 5);
printf(“Average = %f “, (sum/5))
}
23. for -- Entry
Statement
Initialization Statement
Increment Statement
False Test
Condition
?
True
Body of The loop
Following Statement
/* check whether a number is prime or not */
#include<stdio.h>
int main() {
int n,i,factors = 0;
printf("Enter a number : ");
scanf("%d",&n);
for(i = 1; i <= n; i++) {
if((n % i)==0) ++factors;
}
if (factors == 2)
printf("%d is prime number.",n);
else
printf("%d is not prime number.",n);
}
24. Important Functions in math.h
abs(x) absolute value of integer x
ceil(x) rounds up and returns the smallest integer greater than or
equal to x
floor(x) rounds down and returns the largest integer less than or
equal to x
log(x) returns natural logarithm
pow(x,y) returns the value of xy
sqrt(x) returns square root of x
exp(x) returns natural anti logarithm
sin(x) returns sine value where x in radians
cos(x) returns cosine value where x in radians
tan(x) returns tangent values where x in radians
fmod(x,y) calculate x modulo y, where x and y are double
hypot(x,y) calculate hypotenuse of right angle where x,y are sides.
log10(x) returns logarithm base 10
25. www.jntuworld.com
• For More Materials, Text Books, Previous
Papers & Mobile updates of B.TECH,
B.PHARMACY, MBA, MCA of JNTU-
HYD,JNTU-KAKINADA & JNTU-
ANANTAPUR visit www.jntuworld.com