This document discusses the process of compiling programs from source code to executable code. It covers lexical analysis, parsing, semantic analysis, code optimization, and code generation. The overall compilation process involves breaking the source code into tokens, generating an abstract syntax tree, performing semantic checks, translating to intermediate representations, optimizing the code, and finally generating target machine code.
C is a programming language developed in 1972 by Dennis Ritchie at Bell Labs. It is a structured programming language that is highly portable and supports functions. A C program consists of functions, with a main function that is the program entry point. Input/output in C uses predefined functions like printf() and scanf(). A C program is compiled into an executable file that can run on many machine architectures. The document then discusses C program structure, data types, libraries, variables, keywords, operators, and control flow statements like if/else, switch, while, do-while and for loops.
The document discusses the programming language C. It provides a brief history of C including its creation in 1972 by Dennis Ritchie and key developments like ANSI C. It also defines C as a high-level, general purpose language ideal for developing firmware and portable applications. Originally intended for writing system software, C was developed for the Unix Operating System. The document then discusses some basic C concepts like variables, logical operators, and control flow statements like if-else, switch, while loops, do-while loops, and for loops.
This document discusses decision and loop control in C programming. It covers if, if-else, conditional operators, relational operators, logical operators, the conditional operator (? :) and various loops including while, do-while and for loops. Examples are provided to demonstrate the use of if/else, logical operators, conditional operators and while, do-while loops. Flowcharts are also included to illustrate program flow. The document is presented by Vinay Arora and covers basic conditional and loop control structures in C.
The document provides an introduction to the C programming language, including its history and development, features, basic structure of a C program, input/output functions like printf() and scanf(), variables, data types, operators, control statements like if-else, and loops. It explains that C is a procedural, machine-independent language developed in the early 1970s to be used in UNIX operating systems and describes the basic "Hello World" program as an example.
The document discusses the structure and components of a C program. It explains that a C program consists of preprocessor statements, global variable declarations, the main function, and optional sub-functions. The main function contains the primary logic and calls any sub-functions, which can declare their own local variables and contain additional code blocks. Preprocessor statements allow executing code at compile time before the program runs, while global variables can be accessed throughout the entire program and local variables are only accessible within their specific function.
This document provides an overview of the C programming language course contents which includes data types, operators, control statements, functions, arrays, pointers, input/output and string functions. It also discusses the seven steps of programming, C strengths such as efficiency and portability, weaknesses like not being object-oriented, and provides simple C program examples and explanations.
C programming is a widely used programming language. The document provides an overview of key concepts in C programming including variables, data types, operators, decision and loop control statements, functions, pointers, arrays, strings, structures, and input/output functions. It also provides examples to illustrate concepts like arrays, strings, functions, pointers, and structures. The main function is the entry point for all C programs where code execution begins.
This document discusses the process of compiling programs from source code to executable code. It covers lexical analysis, parsing, semantic analysis, code optimization, and code generation. The overall compilation process involves breaking the source code into tokens, generating an abstract syntax tree, performing semantic checks, translating to intermediate representations, optimizing the code, and finally generating target machine code.
C is a programming language developed in 1972 by Dennis Ritchie at Bell Labs. It is a structured programming language that is highly portable and supports functions. A C program consists of functions, with a main function that is the program entry point. Input/output in C uses predefined functions like printf() and scanf(). A C program is compiled into an executable file that can run on many machine architectures. The document then discusses C program structure, data types, libraries, variables, keywords, operators, and control flow statements like if/else, switch, while, do-while and for loops.
The document discusses the programming language C. It provides a brief history of C including its creation in 1972 by Dennis Ritchie and key developments like ANSI C. It also defines C as a high-level, general purpose language ideal for developing firmware and portable applications. Originally intended for writing system software, C was developed for the Unix Operating System. The document then discusses some basic C concepts like variables, logical operators, and control flow statements like if-else, switch, while loops, do-while loops, and for loops.
This document discusses decision and loop control in C programming. It covers if, if-else, conditional operators, relational operators, logical operators, the conditional operator (? :) and various loops including while, do-while and for loops. Examples are provided to demonstrate the use of if/else, logical operators, conditional operators and while, do-while loops. Flowcharts are also included to illustrate program flow. The document is presented by Vinay Arora and covers basic conditional and loop control structures in C.
The document provides an introduction to the C programming language, including its history and development, features, basic structure of a C program, input/output functions like printf() and scanf(), variables, data types, operators, control statements like if-else, and loops. It explains that C is a procedural, machine-independent language developed in the early 1970s to be used in UNIX operating systems and describes the basic "Hello World" program as an example.
The document discusses the structure and components of a C program. It explains that a C program consists of preprocessor statements, global variable declarations, the main function, and optional sub-functions. The main function contains the primary logic and calls any sub-functions, which can declare their own local variables and contain additional code blocks. Preprocessor statements allow executing code at compile time before the program runs, while global variables can be accessed throughout the entire program and local variables are only accessible within their specific function.
This document provides an overview of the C programming language course contents which includes data types, operators, control statements, functions, arrays, pointers, input/output and string functions. It also discusses the seven steps of programming, C strengths such as efficiency and portability, weaknesses like not being object-oriented, and provides simple C program examples and explanations.
C programming is a widely used programming language. The document provides an overview of key concepts in C programming including variables, data types, operators, decision and loop control statements, functions, pointers, arrays, strings, structures, and input/output functions. It also provides examples to illustrate concepts like arrays, strings, functions, pointers, and structures. The main function is the entry point for all C programs where code execution begins.
This document provides an introduction to the C programming language. It covers C program structure, variables, expressions, operators, input/output, loops, decision making statements, arrays, strings, functions, pointers, structures, unions, file input/output and dynamic memory allocation. The document uses examples and explanations to introduce basic C syntax and concepts.
This chapter discusses fundamental concepts of C programming language and basic input/output functions. It covers C development environment, C program structure including main functions and statements, basic data types, input/output functions like printf and scanf, and common programming errors.
Loops allow code to be executed repeatedly. The main loop types are while, for, and do-while loops. While and do-while loops test the condition at the beginning or end of the loop respectively. For loops allow code to be executed a specific number of times. Loops can be nested by placing one loop inside another. Break and continue statements control the flow of loops. Break exits the current loop while continue skips to the next iteration. Though goto can provide unconditional jumps, its use is discouraged due to reducing code readability.
Preprocessor directives are commands that are executed by the C preprocessor before compilation. Common preprocessor directives include #include to add header files, #define for macros, #if/#elif/#else for conditional compilation, and #undef to remove macros. Standard input/output functions like printf(), scanf(), gets(), puts() handle formatted and unformatted console I/O. These functions allow reading user input from the keyboard and displaying output to the monitor.
Important C program of Balagurusamy BookAbir Hossain
This document contains summaries of multiple programming labs involving different programming concepts like functions, arrays, strings, conditionals, loops, etc. The labs cover basics like printing an address, calculating expressions, finding roots of equations, computing trigonometric functions; conditionals like determining if a number is even/odd, larger/smaller; functions including calculating factorial, power series, fibonacci series; arrays for storing student marks, vote counting; strings for manipulation and analysis.
It is an attempt to make the students of IT understand the basics of programming in C in a simple and easy way. Send your feedback for rectification/further development.
This document contains 14 C program examples that print various pyramid patterns. The programs demonstrate basic C programming concepts like loops, conditional statements, functions and demonstrate printing patterns using characters, numbers or both. Each program includes the code, comments on purpose and author. The output displayed below each program code verifies the pattern printed. Overall the document serves as a learning resource for basic C programming and pattern printing techniques.
The document discusses input and output functions in C programming. It describes formatted functions like printf() and scanf() that allow input and output with formatting. It also describes unformatted functions like getchar(), putchar(), gets(), and puts() that handle character and string input/output without formatting. The formatted functions require format specifiers while the unformatted functions work only with character data types.
The document discusses various input and output functions in C programming. It describes formatted and unformatted input/output functions. Formatted functions like scanf() and printf() require format specifiers to identify the data type being read or written. Unformatted functions like getchar() and putchar() only work with character data. The document also covers control statements like if, if-else, switch case that allow conditional execution of code in C. Examples are provided to demonstrate the use of various input, output and control functions.
Chap 2 structure of c programming dti2143alish sha
The document discusses the basic structure of computer programming, including the typical program development environment consisting of six phases: editing/writing, preprocessing, compiling, linking, loading, and executing. It also covers preprocessor directives, the main program structure, data types, variable declarations, common programming errors, and basic C syntax elements like identifiers, variables, constants, and comments.
This document provides an overview of the C programming language. It covers C fundamentals like data types and operators. It also discusses various control structures like decision making (if-else), loops (for, while, do-while), case control (switch) and functions. Additionally, it explains input/output operations, arrays and string handling in C. The document is presented as lecture notes with sections and subsections on different C concepts along with examples.
1. A programming language allows writing instructions as programs to perform tasks. Programs are written in human-readable languages and compiled into machine-readable code.
2. C is one of the earliest and most widely used programming languages. Key aspects of C include data types, keywords, operators, variables, conditional and looping statements, and functions.
3. Programming involves concepts like conditional logic, loops, functions, and data types to solve problems through coded instructions.
This document discusses control flow statements in C programming. It defines control flow statements as blocks of code that control the flow of a program. There are three main types: branching/decision making statements, iterative/looping statements, and jumping statements. Branching statements include if, else if, switch case, and conditional operators. Looping statements include while, for, and do while loops. Jumping statements are break, continue, and goto. Examples are provided for each statement type to illustrate their syntax and usage.
The document discusses functions in C programming. It provides examples of defining functions with parameters and return types, calling functions by passing arguments, using header files to declare functions, and recursion. It shows functions being defined and called to perform tasks like calculating factorials, displaying prices based on hotel rates and nights, and converting numbers to binary. Functions allow breaking programs into smaller, reusable components.
1. The document contains code for 8 programming experiments involving algorithms for calculating simple and compound interest, determining Armstrong and Fibonacci numbers, finding the roots of a quadratic equation, matrix operations, and sorting arrays.
2. The algorithms are presented step-by-step and the C code to implement each algorithm is included and commented.
3. Sample inputs and outputs are provided for each program to demonstrate its functionality.
The document discusses various aspects of loops in C programming, including:
1) It explains the basic structure of a while loop with initialization, condition checking, and incrementation of the loop counter variable.
2) It discusses the scope of variables in loops and the use of increment/decrement operators like ++ and --.
3) It compares the difference between using i++ and ++i as part of a loop, explaining how the order of incrementation vs. printing affects the output.
18CSS101J PROGRAMMING FOR PROBLEM SOLVINGGOWSIKRAJAP
The document discusses various operators, control statements, and arrays in C programming. It begins by explaining operator precedence and types of operators such as relational, logical, increment, assignment etc. It then covers control statements including if-else, switch case, for, while, do-while loops. It also discusses goto, break and continue statements. Finally, it describes arrays including initialization, declaration, accessing elements and array operations. The document provides examples to explain the concepts in detail.
This document provides an introduction to the C programming language. It covers C program structure, variables, expressions, operators, input/output, loops, decision making statements, arrays, strings, functions, pointers, structures, unions, file input/output and dynamic memory allocation. The document uses examples and explanations to introduce basic C syntax and concepts.
This chapter discusses fundamental concepts of C programming language and basic input/output functions. It covers C development environment, C program structure including main functions and statements, basic data types, input/output functions like printf and scanf, and common programming errors.
Loops allow code to be executed repeatedly. The main loop types are while, for, and do-while loops. While and do-while loops test the condition at the beginning or end of the loop respectively. For loops allow code to be executed a specific number of times. Loops can be nested by placing one loop inside another. Break and continue statements control the flow of loops. Break exits the current loop while continue skips to the next iteration. Though goto can provide unconditional jumps, its use is discouraged due to reducing code readability.
Preprocessor directives are commands that are executed by the C preprocessor before compilation. Common preprocessor directives include #include to add header files, #define for macros, #if/#elif/#else for conditional compilation, and #undef to remove macros. Standard input/output functions like printf(), scanf(), gets(), puts() handle formatted and unformatted console I/O. These functions allow reading user input from the keyboard and displaying output to the monitor.
Important C program of Balagurusamy BookAbir Hossain
This document contains summaries of multiple programming labs involving different programming concepts like functions, arrays, strings, conditionals, loops, etc. The labs cover basics like printing an address, calculating expressions, finding roots of equations, computing trigonometric functions; conditionals like determining if a number is even/odd, larger/smaller; functions including calculating factorial, power series, fibonacci series; arrays for storing student marks, vote counting; strings for manipulation and analysis.
It is an attempt to make the students of IT understand the basics of programming in C in a simple and easy way. Send your feedback for rectification/further development.
This document contains 14 C program examples that print various pyramid patterns. The programs demonstrate basic C programming concepts like loops, conditional statements, functions and demonstrate printing patterns using characters, numbers or both. Each program includes the code, comments on purpose and author. The output displayed below each program code verifies the pattern printed. Overall the document serves as a learning resource for basic C programming and pattern printing techniques.
The document discusses input and output functions in C programming. It describes formatted functions like printf() and scanf() that allow input and output with formatting. It also describes unformatted functions like getchar(), putchar(), gets(), and puts() that handle character and string input/output without formatting. The formatted functions require format specifiers while the unformatted functions work only with character data types.
The document discusses various input and output functions in C programming. It describes formatted and unformatted input/output functions. Formatted functions like scanf() and printf() require format specifiers to identify the data type being read or written. Unformatted functions like getchar() and putchar() only work with character data. The document also covers control statements like if, if-else, switch case that allow conditional execution of code in C. Examples are provided to demonstrate the use of various input, output and control functions.
Chap 2 structure of c programming dti2143alish sha
The document discusses the basic structure of computer programming, including the typical program development environment consisting of six phases: editing/writing, preprocessing, compiling, linking, loading, and executing. It also covers preprocessor directives, the main program structure, data types, variable declarations, common programming errors, and basic C syntax elements like identifiers, variables, constants, and comments.
This document provides an overview of the C programming language. It covers C fundamentals like data types and operators. It also discusses various control structures like decision making (if-else), loops (for, while, do-while), case control (switch) and functions. Additionally, it explains input/output operations, arrays and string handling in C. The document is presented as lecture notes with sections and subsections on different C concepts along with examples.
1. A programming language allows writing instructions as programs to perform tasks. Programs are written in human-readable languages and compiled into machine-readable code.
2. C is one of the earliest and most widely used programming languages. Key aspects of C include data types, keywords, operators, variables, conditional and looping statements, and functions.
3. Programming involves concepts like conditional logic, loops, functions, and data types to solve problems through coded instructions.
This document discusses control flow statements in C programming. It defines control flow statements as blocks of code that control the flow of a program. There are three main types: branching/decision making statements, iterative/looping statements, and jumping statements. Branching statements include if, else if, switch case, and conditional operators. Looping statements include while, for, and do while loops. Jumping statements are break, continue, and goto. Examples are provided for each statement type to illustrate their syntax and usage.
The document discusses functions in C programming. It provides examples of defining functions with parameters and return types, calling functions by passing arguments, using header files to declare functions, and recursion. It shows functions being defined and called to perform tasks like calculating factorials, displaying prices based on hotel rates and nights, and converting numbers to binary. Functions allow breaking programs into smaller, reusable components.
1. The document contains code for 8 programming experiments involving algorithms for calculating simple and compound interest, determining Armstrong and Fibonacci numbers, finding the roots of a quadratic equation, matrix operations, and sorting arrays.
2. The algorithms are presented step-by-step and the C code to implement each algorithm is included and commented.
3. Sample inputs and outputs are provided for each program to demonstrate its functionality.
The document discusses various aspects of loops in C programming, including:
1) It explains the basic structure of a while loop with initialization, condition checking, and incrementation of the loop counter variable.
2) It discusses the scope of variables in loops and the use of increment/decrement operators like ++ and --.
3) It compares the difference between using i++ and ++i as part of a loop, explaining how the order of incrementation vs. printing affects the output.
18CSS101J PROGRAMMING FOR PROBLEM SOLVINGGOWSIKRAJAP
The document discusses various operators, control statements, and arrays in C programming. It begins by explaining operator precedence and types of operators such as relational, logical, increment, assignment etc. It then covers control statements including if-else, switch case, for, while, do-while loops. It also discusses goto, break and continue statements. Finally, it describes arrays including initialization, declaration, accessing elements and array operations. The document provides examples to explain the concepts in detail.
Detailing about basics of C language and its control structure for learning C Language for beginners. It covers looping statement , control statement etc.
The document provides an overview of key concepts in C programming including variables, data types, operators, control flow structures like decisions and loops, and functions. It discusses how computers perform simple tasks like addition via inputs, storage in memory, processing, and outputs. Examples are provided to illustrate concepts like printf formatting, if/else statements, for/while loops, and break/continue keywords. Self-check questions review variable definitions, loop execution, and output of sample programs.
The document discusses various operators in C programming language including arithmetic, logical, relational, increment/decrement, assignment, bitwise, equality and other operators. It provides examples of how each operator works along with code snippets demonstrating their usage. Key points covered include how arithmetic operators perform basic math operations, logical operators evaluate conditions, relational operators compare values, and bitwise operators perform operations on individual bits.
C programming uses basic elements like expressions, statements, blocks and functions. Expressions combine constants, variables and operators, while statements end with semicolons. A block of statements is treated as a single statement. Standard library functions include printf(), exit() and scanf(). Control structures like if-else, switch, for, while and do-while statements are used for decision making and looping.
The document discusses different types of looping statements in structured programming languages including for, while, and do-while loops. It provides examples of the syntax and control flow for each loop type. The key points made are:
1) Loops are used to perform repetitive tasks by executing a block of code multiple times. The main loop types are for, while, and do-while.
2) The for loop initializes a counter variable, checks a condition, and updates the counter each iteration.
3) The while loop checks a condition before each iteration and updates the counter within the loop body.
4) The do-while loop executes the body at least once even if the condition is false, then
At the end of this lecture students should be able to;
Describe the looping structures in C programming language.
Practice the control flow of different looping structures in C programming language.
Practice the variants in control flow of different looping structures in C programming language.
Apply taught concepts for writing programs.
The document contains C program code snippets for solving various math and logic problems. These include programs to find roots of a quadratic equation, generate the Fibonacci series, find Armstrong numbers between intervals, check if a number is prime, and convert between binary, decimal and other number bases. It also includes programs to check for palindromes, calculate power of a number using a while loop, and convert decimal numbers to hexadecimal representation.
The document describes the basic structure and components of a C program using flowcharts and code examples. It includes 3 key parts:
1. Preprocessor directives like #include that provide header files and libraries.
2. Input/output functions like printf and scanf that allow transferring data to and from the user.
3. Common operators in C like arithmetic, relational, logical, and unary operators and their order of precedence.
The document uses flowcharts and code snippets to demonstrate how these components fit together in a simple C program that takes input from the user and performs calculations.
The document summarizes control structures in C, including repetition structures like while, do/while, and for loops. It provides examples of using each type of loop, and also covers statements like break, continue, and goto that change a loop's execution flow. Nested structures and counter-controlled repetition are demonstrated.
The document introduces different types of loops in C programming including while, for, and do-while loops. It explains that loops allow repeated execution of a block of code until a certain condition is met. The key types of loops are pretest and post-test loops, which differ in when the loop condition is evaluated. It provides examples of implementing various loops in C and using concepts like initialization, updating, nesting, and break/continue statements.
Unit 1- PROGRAMMING IN C OPERATORS LECTURER NOTESLeahRachael
This document summarizes operators in the C programming language. It discusses arithmetic, unary, relational, logical, and assignment operators. For each operator type, it provides examples of common operators like addition, subtraction, increment, decrement, equality, inequality and examples of how to use them in simple C code snippets. It also covers unary operators like unary minus and plus, and operators for type sizes like sizeof. Overall, the document serves as a basic introduction to different operator categories and syntax in C programming.
The document discusses various code optimization techniques that can be used to improve the efficiency of a program without changing its functionality. It covers techniques like using appropriate data types, avoiding global variables, using arrays instead of switch-case statements, combining loops, putting loops inside functions, and early termination of loops. Optimizing variables, control structures, functions and loops can help reduce memory usage and improve execution speed of a program.
Code optimization techniques aim to improve the efficiency of code without changing its output. Some key techniques include:
- Using appropriate variable types like unsigned integers to improve performance.
- Avoiding global variables which prevent register allocation and introduce overhead.
- Optimizing control structures like replacing if-else with switch.
- Loop optimizations like unrolling small loops, combining nested loops, and early termination.
- Function optimizations like putting loops inside functions and minimizing parameter passing.
- Other techniques like code motion to move invariant code out of loops.
The document discusses different types of control statements in C programming including decision control statements, iteration statements, and transfer statements. It provides details about if, if-else, switch, while, do-while, for loops. Decision control statements like if, if-else, switch allow altering the flow of execution based on certain conditions. Iteration statements like while, do-while, for are used to repeat a block of code until the given condition is true. They allow looping in a program.
The document provides an outline of topics for a C/C++ tutorial, including a "Hello World" program, data types, variables, operators, conditionals, loops, arrays, strings, functions, pointers, command-line arguments, data structures, and memory allocation. It gives examples and explanations of key concepts in C/C++ programming.
C programming language was created in the 1970s by Dennis Ritchie at Bell Labs. It is a middle-level language that combines elements of both high-level and low-level (assembly) languages. The key elements of a C program include documentation, header files, global declarations, main function, and other sub-functions. C programs use variables, constants, data types, operators, and control statements like if-else, switch-case, loops to perform tasks. Common data structures in C include arrays, which are used to store multiple elements of the same type under a single name.
This document contains a summary of chapters from a C++ programming lecture. It covers topics like variables and data types, the structure of C++ programs, input/output stream manipulators, and control structures like if statements. The chapters progress from basic concepts like declaring variables to more advanced topics such as functions, arrays, pointers, and decision making. Examples are provided throughout to illustrate each programming concept.
How to Add Chatter in the odoo 17 ERP ModuleCeline George
In Odoo, the chatter is like a chat tool that helps you work together on records. You can leave notes and track things, making it easier to talk with your team and partners. Inside chatter, all communication history, activity, and changes will be displayed.
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
2. Structure of C program
Preprocessor directives
Global variables
Main(void)
{
Local variables
Statements
…..………
…………….
Return 0;
}
Function()
{
Local variables
Statements
…………..
}
#include<stdio.h>
#define num 10
Static Int I; //static or extern
Main()
{
Int I, num; /* static, global, auto or registers
declaration*/
Int a=5; // initialization
Scanf(“%d”,&i);
Printf(“i=%d,num=%d,a=%d”,I,num,a);
}
3. Compilation and execution of c program
Pre-processor
Compiler
Assembler
Linker
Source code
Expanded code
Assembly code
Object code
Executable code
.c C code
.i intermediate code
.s assembly code
.o object code
.exe / a.out
4. Errors in c program
Compile time error Run time error
Pre processor
error
Translator error
Linker error Segmentation error
Bus error
…….
……..
...…….64 types of errors
5. Data types
Character data type (char)
Signed - 1 byte (-128 to 127)
Unsigned - 1 byte (0 to 255)
Integer data type (int)
Short int : signed - 1 byte (-128 to 127)
Unsigned - 1 byte (0 to 255)
int : signed - 2 byte (-2G to 2G)
Unsigned - 2 byte (0 to 4G)
long int : signed - 4 byte (-4G to 4G)
Unsigned - 4 byte (0 to 8G)
Real data type (float and double)
Float - 4bytes (3.4e-38 to 3.4e+38)
Double - 8 bytes (1.7e-308 to 1.7e+308)
Long double - 10 bytes (3.4e-4932 to 3.4e+4932)
String data type (string)
‘a’ , ’1’
123 , 0X1223
Float (0.25f) and double (0.25)
“1234”, “nishma”
6. Operators
• Arithmetic operator ( + , - , * , / , % ) – binary – doesn’t change the value – result (value)
• Relational operator ( > , >= , < , <= , == , != ) – binary – doesn’t change the value – result (0 or 1)
• Logical or Boolean operator (&& , || , ! ) – binary – doesn’t change the value – result (0 or 1)
• Conditional operator ( [? :] ) – ternary – doesn’t change the value – result (true stat or false stat)
• Bitwise operator ( & , | , ~ , << , >> ,^ ) – binary – changes the value
• Increment and decrement operator ( ++ , -- ) – unary – changes the value
• Size of operator ( sizeof() ) –unary –doesn’t change the value
7. Control statements
Iterative Non - iterative
Conditional Unconditional
For
While
Do while
If
Else if
Switch - case
Goto
Break
Return
Continue
12. Else if ladder
If (expression 1)
Statement 1;
Else if (expression 2)
Statement 2;
Else if (expression 3)
Statement 3;
Else
Statement 4;
Nested if else ladder
If (exp 1)
{
If (exp 2)
{
if (exp 3)
{
S1;
}
else
S2;
}
else
S3;
}
Else
S4;
13. Switch case statement
Switch (expression)
{
Case label 1 : S1;
S2;
break;
Case label 2 : S1;
S2;
break;
Default : S1;
Result should be in
Char, short int, int.
Strings and float are not allowed
Not mandatory
18. While statement
While (expression)
{
Statement 1;
Statement 2;
}
Expression
Body of the loop
True
False
Next statements
While (exp1 ; exp2 ; exp3)
{
Statement 1;
Statement 2;
}
Last exp (exp3)
decides whether
to enter the loop
or not
While (expression)
Statement 1;
19. Example
Int i=0;
While (i==0)
{
Printf(“i=%dn”, i++);
Printf(“i=%dn”,++i);
}
o/p:
i=0
i=2
Int i=0;
While (i==0);
{
Printf(“i=%dn”, i++);
Printf(“i=%dn”,++i);
}
o/p:
Infinite loop
Doesn’t print any value
20. Do While statement
Do
{
Statement 1;
Statement 2;
}
While (expression);
Expression
Body of the loop
True
False
Next statements
Do
Statement 1;
While (expression);
24. Arrays
Data_type array_name [index];
No of elements
in the array
To scan
For (i=0 ; a[i] ; i++)
{
Scanf(“%d”,&a[i]);
}
To print
For (i=0 ; a[i] ; i++)
{
printf(“%d”,a[i]);
}
Array representation
A[i]=i[a]=*(a+i)
Example:
Int a[6];
Int a[6] = {10,20,30,40,50,60};
1D array
25. 2D array
To scan
For (i=0 ; i<n ; i++)
{
for(j=0 ; j<m ; j++)
Scanf(“%d”,&a[i]);
}
To print
For (i=0 ; a[i] ; i++)
{
for(j=0 ; j<m ; j++)
printf(“%d”,a[i]);
}
26. Strings
Data_type string_name [index];
Example:
char s[6];
char s[6] = “hello”;
No of elements
in the string
To scan
For (i=0 ; s[i] ; i++)
{
Scanf(“%c”,&s[i]);
}
Or
Scanf(“%s”,s);
To print
For (i=0 ; s[i] ; i++)
{
printf(“%c”,s[i]);
}
Or
Printf(“%s”,s);
It is a collection of characters terminated by a null symbol (‘o’)
27. Functions
Library function
User defined function
Example:
Sqrt();
Function declaration
Function call
Function definition
Return_type fun_name (type1 par1, type2 par2,…..);
Fun_name (arg1, arg2, arg3);
Return_type fun_name (parameter declarations)
Return (exp);
28. Storage classes
Auto Static Extern Register
Default Garbage 0 0 Garbage
Memory Stack frame Data segment Data segment Stack frame
Scope locally Accessed directly
within a fun or
block
Accessed within
a fun
Accessed within
a fun
Accessed directly
within a fun or
block
globally Cannot be
declared globally
can access
throughout the
file.
can access
throughout the
file.
Cannot be
declared globally
Life Start When fun stack
frame created
When program
is loaded into
RAM
Same as static When fun
execution starts
End When it gets
deallocated
When execution
is completed
Same as static When execution
ends