At the end of this lecture students should be able to;
Define type cast and type promotion in C programming language.
Define command line arguments in C Programming language.
Declare constants according to the C programming.
Apply math.h header file for problem solving.
Apply taught concepts for writing programs.
An array is a collection of similar data types stored in contiguous memory locations. Arrays in C can store primitive data types like int, char, float, etc. Elements of an array are accessed using indexes and they are stored sequentially in memory. Strings in C are arrays of characters terminated by a null character. Common functions to manipulate strings include strlen(), strcpy(), strcat(), strcmp(), strrev(), strlwr(), and strupr().
The document discusses various control flow statements in C programming such as decision control statements (if, if-else, switch-case), looping statements (for, while, do-while loops), break, continue, goto, and functions. It provides examples of using each statement type and explains their syntax and usage. Key aspects like scope of variables, parameter passing methods (call by value, call by reference), and storage classes (auto, static, extern) related to functions are also covered in the document.
This document discusses handling character strings in C. It covers:
1. How strings are stored in memory as ASCII codes appended with a null terminator.
2. Common string operations like reading, comparing, concatenating and copying strings.
3. How to initialize, declare, read and write strings.
4. Useful string handling functions like strlen(), strcpy(), strcat(), strcmp() etc to perform various operations on strings.
The document provides an overview of the C programming language. It discusses the history and creation of C, key features of C like portability and efficiency, C program structure, data types in C including integer, floating point, and character types, and variable naming conventions. It also covers basic C programs and examples to illustrate the use of data types, operators, and input/output functions in C.
This document provides information about C++ programming language tokens and input/output operations. It defines various tokens like keywords, identifiers, literals, punctuators, and operators. It explains the basic structure of a C++ program and defines important headers like iostream. It also describes input/output streams like cout and cin, and input/output operators like << and >>.
The document discusses various C programming concepts including data types, variables, constants, and input/output functions. It covers fundamental data types like integers, floats, characters, and derived types like arrays, pointers, and structures. It also explains variable declaration syntax, integer and floating point input/output, and arithmetic, relational, logical, and conditional operators.
This document discusses handling of character strings in C. It explains that a string is a sequence of characters stored in memory as ASCII codes appended with a null terminator. It describes common string operations in C like reading, displaying, concatenating, comparing and extracting substrings. It also discusses functions like strlen(), strcat(), strcmp(), strcpy() for performing various operations on strings.
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.
An array is a collection of similar data types stored in contiguous memory locations. Arrays in C can store primitive data types like int, char, float, etc. Elements of an array are accessed using indexes and they are stored sequentially in memory. Strings in C are arrays of characters terminated by a null character. Common functions to manipulate strings include strlen(), strcpy(), strcat(), strcmp(), strrev(), strlwr(), and strupr().
The document discusses various control flow statements in C programming such as decision control statements (if, if-else, switch-case), looping statements (for, while, do-while loops), break, continue, goto, and functions. It provides examples of using each statement type and explains their syntax and usage. Key aspects like scope of variables, parameter passing methods (call by value, call by reference), and storage classes (auto, static, extern) related to functions are also covered in the document.
This document discusses handling character strings in C. It covers:
1. How strings are stored in memory as ASCII codes appended with a null terminator.
2. Common string operations like reading, comparing, concatenating and copying strings.
3. How to initialize, declare, read and write strings.
4. Useful string handling functions like strlen(), strcpy(), strcat(), strcmp() etc to perform various operations on strings.
The document provides an overview of the C programming language. It discusses the history and creation of C, key features of C like portability and efficiency, C program structure, data types in C including integer, floating point, and character types, and variable naming conventions. It also covers basic C programs and examples to illustrate the use of data types, operators, and input/output functions in C.
This document provides information about C++ programming language tokens and input/output operations. It defines various tokens like keywords, identifiers, literals, punctuators, and operators. It explains the basic structure of a C++ program and defines important headers like iostream. It also describes input/output streams like cout and cin, and input/output operators like << and >>.
The document discusses various C programming concepts including data types, variables, constants, and input/output functions. It covers fundamental data types like integers, floats, characters, and derived types like arrays, pointers, and structures. It also explains variable declaration syntax, integer and floating point input/output, and arithmetic, relational, logical, and conditional operators.
This document discusses handling of character strings in C. It explains that a string is a sequence of characters stored in memory as ASCII codes appended with a null terminator. It describes common string operations in C like reading, displaying, concatenating, comparing and extracting substrings. It also discusses functions like strlen(), strcat(), strcmp(), strcpy() for performing various operations on strings.
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.
The document discusses operators and casts in C#. It covers various types of operators like arithmetic, comparison, conditional, etc. It explains implicit and explicit type conversions between primitive and reference types. It also discusses overloading operators for custom types and implementing user-defined casts.
This document discusses strings in C programming. It defines strings as arrays of characters that end with a null terminator (\0). It explains how to initialize and print strings. Common string functions like strlen(), strcpy(), strcat(), and strcmp() are described. The document contrasts strings and character pointers, noting strings cannot be reassigned while pointers can. Finally, it lists and briefly explains other standard string library functions.
Constants Variables Datatypes by Mrs. Sowmya JyothiSowmyaJyothi3
C provides various data types to store different types of data. The main data types are integer, float, double, and char. Variables are used to store and manipulate data in a program. Variables must be declared before use, specifying the data type. Constants are fixed values that don't change, and can be numeric, character, or string values. Symbolic constants can be defined to represent constant values used throughout a program. Input and output of data can be done using functions like scanf and printf.
Pointers allow a variable to hold the memory address of another variable. A pointer variable contains the address of the variable it points to. Pointers can be used to pass arguments to functions by reference instead of by value, allowing the function to modify the original variables. Pointers also allow a function to return multiple values by having the function modify pointer variables passed to it by the calling function. Understanding pointers involves grasping that a pointer variable contains an address rather than a value, and that pointers enable indirect access to the value at a specific memory address.
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.
1. There are two main ways to handle input-output in C - formatted functions like printf() and scanf() which require format specifiers, and unformatted functions like getchar() and putchar() which work only with characters.
2. Formatted functions allow formatting of different data types like integers, floats, and strings. Unformatted functions only work with characters.
3. Common formatted functions include printf() for output and scanf() for input. printf() outputs data according to format specifiers, while scanf() reads input and stores it in variables based on specifiers.
Constants refer to fixed values that cannot be altered during program execution. They include integer, floating point, character, and string literals. Constants are defined using the #define preprocessor or const keyword and are treated like regular variables except their values cannot change. Common operators in C include arithmetic, relational, logical, and bitwise operators that perform math, comparison, logic and bit manipulation functions.
This document provides an overview of C programming basics including character sets, tokens, keywords, variables, data types, and control statements in C language. Some key points include:
- The C character set includes lowercase/uppercase letters, digits, special characters, whitespace, and escape sequences.
- Tokens in C include operators, special symbols, string constants, identifiers, and keywords. There are 32 reserved keywords that should be in lowercase.
- Variables are named locations in memory that hold values. They are declared with a data type and initialized by assigning a value.
- C has primary data types like int, float, char, and double. Derived types include arrays, pointers, unions, structures,
The document discusses three-address code, which is an intermediate representation used in compilers. It describes three-address code as consisting of statements in the form of x := y op z, where x, y, and z are operands and op is an operator. There are several types of three-address statements including assignment, copy, jump, conditional jump, procedure calls, indexed assignments, and pointer assignments. Three-address code can be implemented using quadruples, triples, or indirect triples, which represent the statements using records with fields for operands and operators.
The document discusses the basics of C language including tokens, data types, constants, and variables. It covers keywords, identifiers, operators, and other tokens in C. It describes the basic integral and floating point data types like int, char, float, and double. It also discusses numerical, character, and string constants. Finally, it explains how to declare variables and the differences between global and local variables.
C is a general-purpose programming language initially developed for system development like operating systems. It produces efficient code nearly as fast as assembly language. The document provides an overview of basic C programming concepts including data types, variables, functions, arrays, structures, pointers, strings, input/output operations, and preprocessor directives. It also gives examples of basic "Hello World" program structure and syntax.
The document discusses input and output functions in C programming. It describes getchar() and putchar() for character input/output, printf() and scanf() for formatted input/output, and gets() and puts() for string input/output. It provides examples of using these functions to read input from the keyboard and display output to the screen.
This document provides an overview of key concepts in C programming including data types, variables, constants, arithmetic expressions, assignment statements, and logical expressions. It discusses how integers, characters, and floating-point numbers are represented in C. It also explains the different types of constants and variables as well as the various arithmetic, assignment, and logical operators supported in C. Examples are provided to demonstrate the use of these operators.
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.
C# is an object-oriented programming language where all program logic must be contained within classes. It has features like garbage collection, inheritance, interfaces, namespaces, and data types similar to Java. Key concepts include value types vs reference types, boxing and unboxing, arrays, enums, structs, and parameter passing modes like pass by value, reference, and output. The language has control structures like if/else, switch, while, for, and foreach loops to control program flow. Methods can be instance methods or static methods.
This document discusses various topics related to processing and interactive input in C programming, including:
- Assignment statements and implicit/explicit type conversions
- Mathematical library functions like sqrt()
- Using scanf() for interactive input and ensuring valid user input
- Formatted output using printf() and format modifiers
- Common errors like failing to initialize variables or using incorrect data types.
The document discusses operators and casts in C#. It covers various types of operators like arithmetic, comparison, conditional, etc. It explains implicit and explicit type conversions between primitive and reference types. It also discusses overloading operators for custom types and implementing user-defined casts.
This document discusses strings in C programming. It defines strings as arrays of characters that end with a null terminator (\0). It explains how to initialize and print strings. Common string functions like strlen(), strcpy(), strcat(), and strcmp() are described. The document contrasts strings and character pointers, noting strings cannot be reassigned while pointers can. Finally, it lists and briefly explains other standard string library functions.
Constants Variables Datatypes by Mrs. Sowmya JyothiSowmyaJyothi3
C provides various data types to store different types of data. The main data types are integer, float, double, and char. Variables are used to store and manipulate data in a program. Variables must be declared before use, specifying the data type. Constants are fixed values that don't change, and can be numeric, character, or string values. Symbolic constants can be defined to represent constant values used throughout a program. Input and output of data can be done using functions like scanf and printf.
Pointers allow a variable to hold the memory address of another variable. A pointer variable contains the address of the variable it points to. Pointers can be used to pass arguments to functions by reference instead of by value, allowing the function to modify the original variables. Pointers also allow a function to return multiple values by having the function modify pointer variables passed to it by the calling function. Understanding pointers involves grasping that a pointer variable contains an address rather than a value, and that pointers enable indirect access to the value at a specific memory address.
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.
1. There are two main ways to handle input-output in C - formatted functions like printf() and scanf() which require format specifiers, and unformatted functions like getchar() and putchar() which work only with characters.
2. Formatted functions allow formatting of different data types like integers, floats, and strings. Unformatted functions only work with characters.
3. Common formatted functions include printf() for output and scanf() for input. printf() outputs data according to format specifiers, while scanf() reads input and stores it in variables based on specifiers.
Constants refer to fixed values that cannot be altered during program execution. They include integer, floating point, character, and string literals. Constants are defined using the #define preprocessor or const keyword and are treated like regular variables except their values cannot change. Common operators in C include arithmetic, relational, logical, and bitwise operators that perform math, comparison, logic and bit manipulation functions.
This document provides an overview of C programming basics including character sets, tokens, keywords, variables, data types, and control statements in C language. Some key points include:
- The C character set includes lowercase/uppercase letters, digits, special characters, whitespace, and escape sequences.
- Tokens in C include operators, special symbols, string constants, identifiers, and keywords. There are 32 reserved keywords that should be in lowercase.
- Variables are named locations in memory that hold values. They are declared with a data type and initialized by assigning a value.
- C has primary data types like int, float, char, and double. Derived types include arrays, pointers, unions, structures,
The document discusses three-address code, which is an intermediate representation used in compilers. It describes three-address code as consisting of statements in the form of x := y op z, where x, y, and z are operands and op is an operator. There are several types of three-address statements including assignment, copy, jump, conditional jump, procedure calls, indexed assignments, and pointer assignments. Three-address code can be implemented using quadruples, triples, or indirect triples, which represent the statements using records with fields for operands and operators.
The document discusses the basics of C language including tokens, data types, constants, and variables. It covers keywords, identifiers, operators, and other tokens in C. It describes the basic integral and floating point data types like int, char, float, and double. It also discusses numerical, character, and string constants. Finally, it explains how to declare variables and the differences between global and local variables.
C is a general-purpose programming language initially developed for system development like operating systems. It produces efficient code nearly as fast as assembly language. The document provides an overview of basic C programming concepts including data types, variables, functions, arrays, structures, pointers, strings, input/output operations, and preprocessor directives. It also gives examples of basic "Hello World" program structure and syntax.
The document discusses input and output functions in C programming. It describes getchar() and putchar() for character input/output, printf() and scanf() for formatted input/output, and gets() and puts() for string input/output. It provides examples of using these functions to read input from the keyboard and display output to the screen.
This document provides an overview of key concepts in C programming including data types, variables, constants, arithmetic expressions, assignment statements, and logical expressions. It discusses how integers, characters, and floating-point numbers are represented in C. It also explains the different types of constants and variables as well as the various arithmetic, assignment, and logical operators supported in C. Examples are provided to demonstrate the use of these operators.
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.
C# is an object-oriented programming language where all program logic must be contained within classes. It has features like garbage collection, inheritance, interfaces, namespaces, and data types similar to Java. Key concepts include value types vs reference types, boxing and unboxing, arrays, enums, structs, and parameter passing modes like pass by value, reference, and output. The language has control structures like if/else, switch, while, for, and foreach loops to control program flow. Methods can be instance methods or static methods.
This document discusses various topics related to processing and interactive input in C programming, including:
- Assignment statements and implicit/explicit type conversions
- Mathematical library functions like sqrt()
- Using scanf() for interactive input and ensuring valid user input
- Formatted output using printf() and format modifiers
- Common errors like failing to initialize variables or using incorrect data types.
Functions in C allow programmers to package blocks of code that perform tasks. Functions make code reusable and easier to understand by separating code into modular units. A function has a name, list of arguments it takes, and code that is executed when the function is called. Functions can communicate between each other via parameters passed by value or by reference. Parameters passed by value are copied, so changes inside the function don't affect the original variable, while parameters passed by reference allow the function to modify the original variable. Functions can also call themselves recursively.
02a fundamental c++ types, arithmetic Manzoor ALam
The document discusses fundamental C++ types including integers, characters, and floating-point numbers. It describes integer types like int, short, and long and their typical sizes. Character types represent single characters with examples of escape codes. Floating-point types can represent real numbers in formats like float and double. The document also covers C++ concepts such as variable definitions and declarations, arithmetic operators, assignment, and increment/decrement operators.
This document discusses various fundamental concepts in C programming such as flowcharts, pseudocode, control structures, variables, data types, operators, functions, arrays, structures, and input/output functions. It provides definitions and examples for each concept. Control structures covered include conditional statements like if-else and switch-case, as well as loops like while, do-while and for. Data types discussed are integer, floating point, character and string constants. Key concepts like variables, arrays, structures, functions and their declarations are also summarized.
Esoft Metro Campus - Certificate in c / c++ programmingRasan Samarasinghe
Esoft Metro Campus - Certificate in java basics
(Template - Virtusa Corporate)
Contents:
Structure of a program
Variables & Data types
Constants
Operators
Basic Input/output
Control Structures
Functions
Arrays
Character Sequences
Pointers and Dynamic Memory
Unions
Other Data Types
Input/output with files
Searching
Sorting
Introduction to data structures
This document provides information about functions in C programming. It defines a function as a block of code that performs a specific task and can be reused. The general form of a function definition includes the return type, function name, parameters, and function body. Functions allow breaking a large, complex program into smaller, modular sub-programs. Parameters are used to pass values between the calling function and the called function. Variables have local scope and are only accessible within the function they are defined, so parameters must be explicitly passed between functions. Functions can return values to the calling function using the return statement.
1. A program to display a name. It prints "My name is John" using printf.
2. A program that adds two numbers. It uses scanf to input two integers, adds them together with +, and prints the result with printf.
3. A program that calculates the radius of a circle given its area. It uses scanf to input the area, calculates the radius by taking the square root of (area/pi), and prints the radius to 3 decimal places using printf and the format specifier %.3f.
This document provides an introduction to C++ programming, covering key concepts like characters, tokens, keywords, identifiers, literals, operators, input/output, variables, comments, and common errors. It explains that C++ was created by Bjarne Stroustrup in the 1980s as an extension of C with object-oriented features from Simula 67.
This document provides an introduction to C++ programming, covering key concepts like characters, tokens, keywords, identifiers, literals, operators, I/O streams, variables, comments, and common errors. It explains that Bjarne Stroustrup extended C to create C++, adding object-oriented features from Simula. The main components discussed are the building blocks of any C++ program - characters, tokens, data types, and basic input/output operations.
This document discusses functions in C programming. It defines what a function is and explains why we use functions. There are two types of functions - predefined and user-defined. User-defined functions have elements like function declaration, definition, and call. Functions can pass parameters by value or reference. The document also discusses recursion, library functions, and provides examples of calculating sine series using functions.
The document provides an overview of key concepts in the C programming language, including:
- Data types, variables, constants, and arrays. Arrays must be declared before use with the format data-type variable-name[size]. Two dimensional arrays are supported.
- Storage classes like automatic, external/global, static, and register that determine variable scope, lifetime, and memory location.
- Functions and different ways they can be called in C - call by value where copies of arguments are passed, and call by reference where addresses of variables are passed.
This document discusses tokens in the C programming language. It defines tokens as the basic building blocks of a C program, including keywords, identifiers, constants, string literals, and symbols. It provides examples of different token types and explains their meanings. It also covers identifiers, keywords, variables, constants, strings, input/output functions, and writing a basic C program.
The document discusses intermediate code generation in compilers. It describes how compilers generate an intermediate representation from the abstract syntax tree that is machine independent and allows for optimizations. One popular intermediate representation is three-address code, where each statement contains at most three operands. This code is then represented using structures like quadruples and triples to store the operator and operands for code generation and rearranging during optimizations. Static single assignment form is also covered, which assigns unique names to variables to facilitate optimizations.
Bsc cs i pic u-4 function, storage class and array and stringsRai University
The document discusses arrays and functions in C programming. It defines arrays as groups of related data items that share a common name. One-dimensional and multi-dimensional arrays are described. Functions are defined as reusable blocks of code that can take input arguments and return values. The key elements of functions like return values, arguments, and function calls are explained. Common string handling and mathematical functions are also summarized.
The document discusses pointers in C++. It defines a pointer as a variable that stores the memory address of another variable of the same data type. Pointers allow a program to indirectly access the memory location of another variable. The key points covered include:
- Declaring pointer variables using a data type followed by an asterisk (*)
- Initializing pointers using the address-of (&) operator to store the address of another variable
- Accessing the value at a pointer's address using the dereference (*) operator
- Pointer arithmetic, where pointers can be incremented or decremented to access subsequent memory addresses
- Dynamic memory allocation using new/delete to allocate memory at runtime through a pointer.
The document discusses various topics related to programming in C including data types, constants, expressions, decision making statements, and a sample C program structure. It provides 20 questions with explanations on these topics. It also includes a sample C program to calculate the sum of 10 non-negative numbers entered by the user, illustrating the use of various data types in C programming.
Similar to COM1407: Type Casting, Command Line Arguments and Defining Constants (20)
This document discusses parsing with context-free grammars. It begins by introducing context-free grammars and their use in parsing sentences. It then discusses parsing as a search problem, and presents top-down and bottom-up parsing algorithms. Top-down parsing builds trees from the root node down, while bottom-up parsing builds trees from the leaves up. Both approaches have advantages and disadvantages related to efficiency. The document also introduces probabilistic context-free grammars, which augment grammars with rule probabilities, and discusses how these can be used for disambiguation.
The document discusses context-free grammars for modeling English syntax. It introduces key concepts like constituency, grammatical relations, and subcategorization. Context-free grammars use rules and symbols to generate sentences. They consist of terminal symbols (words), non-terminal symbols (phrases), and rules to expand non-terminals. Context-free grammars can model syntactic knowledge and generate sentences in both a top-down and bottom-up manner through parsing.
Parts-of-speech can be divided into closed classes and open classes. Closed classes have a fixed set of members like prepositions, while open classes like nouns and verbs are continually changing with new words being created. Parts-of-speech tagging is the process of assigning a part-of-speech tag to each word using statistical models trained on tagged corpora. Hidden Markov Models are commonly used, where the goal is to find the most probable tag sequence given an input word sequence.
This document provides an overview of Markov models and hidden Markov models (HMMs). It begins by introducing Markov chains, which are probabilistic state machines where the probability of transitioning to the next state depends only on the current state. Hidden Markov models extend Markov chains by adding hidden states that are not directly observable. The key aspects of HMMs are defined, including the hidden states, observed outputs, transition probabilities, and output probabilities. The document then discusses how to compute the likelihood of an observed sequence given an HMM, including using the forward algorithm to efficiently sum over all possible state sequences. Overall, the document provides a conceptual introduction to Markov models and HMMs, focusing on their structure, assumptions, and the forward algorithm
The document discusses various techniques for smoothing N-gram language models, including Laplace smoothing, Good-Turing discounting, and backoff models. Laplace smoothing involves adding one to all counts to address unseen events. Good-Turing smoothing estimates probabilities for low counts based on the frequency of higher counts. Backoff models first use the highest available order N-gram model and only fallback to a lower order if the current count is zero.
This document discusses methods for evaluating language models, including intrinsic and extrinsic evaluation. Intrinsic evaluation involves measuring a model's performance on a test set using metrics like perplexity, which is based on how well the model predicts the test set. Extrinsic evaluation embeds the model in an application and measures the application's performance. The document also covers techniques for dealing with unknown words like replacing low-frequency words with <UNK> and estimating its probability from training data.
The document discusses N-gram language models, which assign probabilities to sequences of words. An N-gram is a sequence of N words, such as a bigram (two words) or trigram (three words). The N-gram model approximates the probability of a word given its history as the probability given the previous N-1 words. This is called the Markov assumption. Maximum likelihood estimation is used to estimate N-gram probabilities from word counts in a corpus.
The document discusses minimum edit distance and how it can be used to quantify the similarity between two strings. Minimum edit distance is defined as the minimum number of editing operations like insertion, deletion, substitution needed to transform one string into another. Levenshtein distance assigns a cost of 1 to each insertion, deletion, or substitution, and calculates the minimum edits between two strings using dynamic programming to build up solutions from sub-problems. The algorithm can also be modified to produce an alignment between the strings by storing back pointers and doing a backtrace.
Finite-state morphological parsing uses finite-state transducers to parse words into their morphological components like stems and affixes. It requires a lexicon of stems and affixes, morphotactic rules describing valid morpheme combinations, and orthographic rules for spelling changes. The parser is built as a cascade of finite-state automata representing the lexicon, morphotactics and spelling rules. It maps surface word forms onto their underlying lexical representations including stems and morphological features. This allows morphological analysis of both regular and irregular forms.
The document discusses English morphology, including singular and plural forms, morphological parsing and stemming, and the different types of morphology in English such as inflectional, derivational, compounding, and cliticization morphology. It provides examples to illustrate singular and plural forms, morphological rules for changing word endings, and how prefixes, suffixes, and other morphemes can be added to word stems to change word classes or derive new words.
The document discusses text normalization, which involves segmenting and standardizing text for natural language processing. It describes tokenizing text into words and sentences, lemmatizing words into their root forms, and standardizing formats. Tokenization involves separating punctuation, normalizing word formats, and segmenting sentences. Lemmatization determines that words have the same root despite surface differences. Sentence segmentation identifies sentence boundaries, which can be ambiguous without context. Overall, text normalization prepares raw text for further natural language analysis.
The document discusses finite state automata (FSA) and regular expressions. It provides examples of deterministic and non-deterministic FSA that recognize strings containing combinations of words. Non-deterministic FSA can have multiple possible state transitions for a given input, requiring strategies like backing up, look-ahead, or parallel processing to determine if a string is accepted. FSA and regular expressions can define regular languages by generating all matching strings.
This document discusses various techniques for text normalization and pattern matching using regular expressions. It covers tokenization, lemmatization, edit distance, and basic regular expression patterns including character classes, quantifiers, anchors, precedence, and disjunction. The key goals of text normalization are to standardize text into a convenient form for processing, while regular expressions provide a language for specifying text search patterns.
This document provides an introduction to natural language processing and the knowledge and techniques required. It discusses:
1) The goals of natural language processing including enabling human-machine communication, improving human-human communication, and processing text/speech.
2) The different types of linguistic knowledge needed such as phonetics, phonology, morphology, syntax, semantics, pragmatics, and discourse.
3) Common models used like state machines, rule systems, logic, probabilistic models, and vector spaces and related algorithms like search algorithms, machine learning algorithms, and dynamic programming.
At the end of this lecture students should be able to;
Define the C standard functions for managing file input output.
Apply taught concepts for writing programs.
At the end of this lecture students should be able to;
Define the declaration C strings.
Compare fixed length and variable length string.
Apply strings for functions.
Define string handling functions.
Apply taught concepts for writing programs.
At the end of this lecture students should be able to;
Define, initialize and access to the C stuctuers.
Develop programs using structures in arrays and functions.
Use structures within structures and structures as pointers.
Define, initialize and access to the C unions.
Compare and contrast C structures and unions.
Define memory allocation and de-allocation methods in C.
Develop programs using memory allocation functions.
Apply taught concepts for writing programs.
At the end of this lecture students should be able to;
Define the C standard functions for managing input output.
Apply taught concepts for writing programs.
Pointer variables allow programmers to indirectly access and manipulate the memory addresses where variables are stored. Pointers must be declared with a data type and initialized by assigning the address of an existing variable using the address-of operator (&). Pointer variables can then be used to read from and write to the memory location of the variable being pointed to using indirection (*). Pointers enable operations like traversing arrays, passing arguments by reference, and dynamically allocating memory. Key pointer concepts covered include declaration, initialization, dereferencing, arithmetic, comparisons, NULL pointers, and their usage with arrays.
At the end of this lecture students should be able to;
Describe the C arrays.
Practice the declaration, initialization and access linear arrays.
Practice the declaration, initialization and access two dimensional arrays.
Apply taught concepts for writing programs.
Executive Directors Chat Leveraging AI for Diversity, Equity, and InclusionTechSoup
Let’s explore the intersection of technology and equity in the final session of our DEI series. Discover how AI tools, like ChatGPT, can be used to support and enhance your nonprofit's DEI initiatives. Participants will gain insights into practical AI applications and get tips for leveraging technology to advance their DEI goals.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
How to Fix the Import Error in the Odoo 17Celine George
An import error occurs when a program fails to import a module or library, disrupting its execution. In languages like Python, this issue arises when the specified module cannot be found or accessed, hindering the program's functionality. Resolving import errors is crucial for maintaining smooth software operation and uninterrupted development processes.
Assessment and Planning in Educational technology.pptxKavitha Krishnan
In an education system, it is understood that assessment is only for the students, but on the other hand, the Assessment of teachers is also an important aspect of the education system that ensures teachers are providing high-quality instruction to students. The assessment process can be used to provide feedback and support for professional development, to inform decisions about teacher retention or promotion, or to evaluate teacher effectiveness for accountability purposes.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
COM1407: Type Casting, Command Line Arguments and Defining Constants
1. COM1407
Computer Programming
Lecture 04
Type Casting, Command Line Arguments
and Defining Constants
K.A.S.H. Kulathilake
B.Sc. (Hons) IT, MCS , M.Phil., SEDA(UK)
Rajarata University of Sri Lanka
Department of Physical Sciences
1
2. Objectives
• At the end of this lecture students should be able
to;
▫ Define type cast and type promotion in C
programming language.
▫ Define command line arguments in C
Programming language.
▫ Declare constants according to the C
programming.
▫ Apply math.h header file for problem solving.
▫ Apply taught concepts for writing programs.
2
3. Type Casting
• Type cast is an instruction to the compiler to convert
one type into another.
• For example, if you want to store a 'long' value into a
simple integer then you can type cast 'long' to 'int'.
• Here, target-type specifies the desired type to
convert the specified expression to.
• You can convert the values from one type to another
explicitly using the cast operator as follows:
(type_name) expression
3
4. Type Casting (Cont…)
• When a cast involves a narrowing conversion,
information might be lost.
• For example, when casting a long into a short,
information will be lost if the long’s value is
greater than the range of a short because its
high-order bits are removed.
• When a floating-point value is cast to an integer
type, the fractional component will also be lost
due to truncation.
4
5. Type Casting (Cont…)
#include <stdio.h>
int main() {
int sum = 17, count = 5;
double mean;
mean = sum / count;
printf("Value of mean : %fn", mean );
return 0;
}
5
Value of mean : 3.000000
6. Type Casting (Cont…)
#include <stdio.h>
int main() {
int sum = 17, count = 5;
double mean;
mean = (double) sum / count;
printf("Value of mean : %fn", mean );
return 0;
}
6
Value of mean : 3.400000
It should be noted here that
the cast operator has
precedence over division, so
the value of sum is first
converted to
type double and finally it
gets divided by count yielding
a double value.
7. Type Promotion/ Automatic Casting
• When one type of data is assigned to another type of
variable, an automatic type conversion will take place if
▫ The two types are compatible. E.g. boolean and char is
not compatible.
▫ The destination type is larger than source type.
• For example, the int type is always large enough to hold
all valid short values, and both int and short are integer
types, so an automatic conversion from short to int can
be applied.
7
8. Type Promotion/ Automatic Casting
(Cont…)
#include <stdio.h>
int main() {
int i = 17;
char c = 'c'; /* ascii value is 99 */
int sum;
sum = i + c;
printf("Value of sum : %dn", sum );
return 0;
}
8
Here, the value of sum is 116 because the
compiler is doing integer promotion and
converting the value of 'c' to ASCII
before performing the actual addition
operation.
9. Typical Arithmetic Conversion
• The typical arithmetic
conversions are implicitly
performed to cast their values to
a common type.
• The compiler first
performs integer promotion; if
the operands still have different
types, then they are converted to
the type that appears highest in
the given hierarchy.
9
10. Typical Arithmetic Conversion (Cont…)
• In any program it is recommended to only
perform arithmetic operations on pairs of values
of the same type.
• When compatible types are mixed in an
assignment, the value of the right side is
automatically converted to the type of the left
side.
• However, because of Java’s strict type checking,
not all types are compatible, and thus, not all
type conversions are implicitly allowed.
10
11. Typical Arithmetic Conversion (Cont…)
• For widening conversions, the numeric types,
including integer and floating-point types, are
compatible with each other.
• There are no automatic conversions from the
numeric types to char or boolean. Also, char and
boolean are not compatible with each other.
• However, an integer literal can be assigned to
char
11
12. Typical Arithmetic Conversion (Cont…)
#include <stdio.h>
int main (void)
{
float f1 = 123.125, f2;
int i1, i2 = -150;
char c = 'a';
/* floating to integer conversion */
i1 = f1;
printf ("%f assigned to an int produces %in", f1, i1);
/* integer to floating conversion */
f1 = i2;
printf ("%i assigned to a float produces %fn", i2, f1);
12
13. Typical Arithmetic Conversion (Cont…)
/* integer divided by integer */
f1 = i2 / 100;
printf ("%i divided by 100 produces %fn", i2, f1);
/* integer divided by a float */
f2 = i2 / 100.0;
printf ("%i divided by 100.0 produces %fn", i2, f2);
/* type cast operator */
f2 = (float) i2 / 100;
printf ("(float) %i divided by 100 produces %fn", i2, f2);
return 0;
}
13
123.125000 assigned to an int produces 123
-150 assigned to a float produces -150.000000
-150 divided by 100 produces -1.000000
-150 divided by 100.0 produces -1.500000
(float) -150 divided by 100 produces -1.500000
14. Command Line Arguments
• It is possible to pass some values from the command
line to your C programs when they are executed.
• These values are called command line
arguments and many times they are important for
your program especially when you want to control
your program from outside instead of hard coding
those values inside the code.
• The command line arguments are handled using
main() function arguments where argc refers to the
number of arguments passed, and argv[] is a
pointer array which points to each argument passed
to the program.
14
15. Command Line Arguments (Cont…)
#include <stdio.h>
int main( int argc, char *argv[] )
{
printf("The first argument supplied is %sn", argv[0]);
printf("The second argument supplied is %sn",
argv[1]);
return 0;
}
15
F:CL04>CommandLineArguments.exe test
The first argument supplied is CommandLineArguments.exe
The second argument supplied is test
When you run the program remember to
pass the arguments
16. Command Line Arguments (Cont…)
• It should be noted that argv[0] holds the name of the
program itself and argv[1] is a pointer to the first
command line argument supplied, and *argv[n] is the
last argument.
• If no arguments are supplied, argc will be one, and if you
pass one argument then argc is set at 2.
• E.g. F:CL04>CommandLineArguments.exe test
16
argv CommandLineArguments.exe test
argc is 2 here
17. Command Line Arguments (Cont…)
#include <stdio.h>
int main( int argc, char
*argv[] )
{
printf("The first
argument supplied is %sn",
argv[0]);
printf("The second
argument supplied is %sn",
argv[1]);
printf("The third
argument supplied is %sn",
argv[2]);
return 0;
}
17
F:CL04>CommandLineArguments.exe arg1 arg2
The first argument supplied is
CommandLineArguments.exe
The second argument supplied is arg1
The third argument supplied is arg2
F:CL04>CommandLineArguments.exe "arg1" "arg2"
The first argument supplied is
CommandLineArguments.exe
The second argument supplied is arg1
The third argument supplied is arg2
F:CL04>CommandLineArguments.exe "arg1" arg2
The first argument supplied is
CommandLineArguments.exe
The second argument supplied is arg1
The third argument supplied is arg2
18. Command Line Arguments (Cont…)
18
F:CL04>CommandLineArguments.exe arg1 "arg2"
The first argument supplied is
CommandLineArguments.exe
The second argument supplied is arg1
The third argument supplied is arg2
F:CL04>CommandLineArguments.exe arg1, arg2
The first argument supplied is
CommandLineArguments.exe
The second argument supplied is arg1,
The third argument supplied is arg2
#include <stdio.h>
int main( int argc, char
*argv[] )
{
printf("The first
argument supplied is %sn",
argv[0]);
printf("The second
argument supplied is %sn",
argv[1]);
printf("The third
argument supplied is %sn",
argv[2]);
return 0;
}
19. Defining Constants
• There are two ways to define constant in C
programming:
▫ Using the const key word.
#define come before the program main block.
const data_type constant_name = constant_value;
const float PI = 3.1412;
▫ Using the #define directive.
#define constant_name constant_value
#define PI 3.1412
19
20. Defining Constants (Cont…)
• Write a program to read the radius of a circle and print out the perimeter of
it on the screen.
#include <stdio.h>
#define PI 3.1412
int main ()
{
float radius;
printf ("Enter the radius in mm : n");
scanf ("%f",&radius);
printf("The perimeter is : %.2f", 2*PI*radius);
return 0;
}
20
21. Defining Constants (Cont…)
#include <stdio.h>
int main ()
{
const float PI = 3.1412;
float radius;
printf ("Enter the radius in mm : n");
scanf ("%f",&radius);
printf("The perimeter is : %.2f", 2*PI*radius);
return 0;
}
21
22. Math Functions
• The math.h header defines various
mathematical functions.
• All the functions available in this library
take double as an argument and
return double as the result.
• You can find documentation via:
▫ http://devdocs.io/c/numeric/math
22
23. Math Functions (Cont…)
S.N. Function & Description
1 double acos(double x)
Returns the arc cosine of x in radians.
2 double asin(double x)
Returns the arc sine of x in radians.
3 double atan(double x)
Returns the arc tangent of x in radians.
4 double atan2(double y, double x)
Returns the arc tangent in radians of y/x based on the signs of both values to
determine the correct quadrant.
5 double cos(double x)
Returns the cosine of a radian angle x.
6 double cosh(double x)
Returns the hyperbolic cosine of x.
7 double sin(double x)
Returns the sine of a radian angle x.
23
24. Math Functions (Cont…)
8 double sinh(double x)
Returns the hyperbolic sine of x.
9 double tanh(double x)
Returns the hyperbolic tangent of x.
10 double exp(double x)
Returns the value of e raised to the xth power.
11 double frexp(double x, int *exponent)
The returned value is the mantissa and the integer pointed to by exponent is the
exponent. The resultant value is x = mantissa * 2 ^ exponent.
12 double ldexp(double x, int exponent)
Returns x multiplied by 2 raised to the power of exponent.
13 double log(double x)
Returns the natural logarithm (base-e logarithm) of x.
14 double log10(double x)
Returns the common logarithm (base-10 logarithm) of x.
24
25. Math Functions (Cont…)
15 double modf(double x, double *integer)
The returned value is the fraction component (part after the decimal), and sets
integer to the integer component.
16 double pow(double x, double y)
Returns x raised to the power of y.
17 double sqrt(double x)
Returns the square root of x.
18 double ceil(double x)
Returns the smallest integer value greater than or equal to x.
19 double fabs(double x)
Returns the absolute value of x.
20 double floor(double x)
Returns the largest integer value less than or equal to x.
21 double fmod(double x, double y)
Returns the remainder of x divided by y.
25
27. Objective Re-cap
• Now you should be able to:
▫ Define type cast and type promotion in C
programming language.
▫ Define command line arguments in C
Programming language.
▫ Declare constants according to the C
programming.
▫ Apply math.h header file for problem solving.
▫ Apply taught concepts for writing programs.
27