The document discusses implementing a function to check if a character is a hexadecimal digit. It explains that a hexadecimal digit ranges from 0-9, A-F, a-f in the ASCII table. It provides examples of inputting different characters and checking if they are hexadecimal digits or not. The sample execution section is empty. It lists functions as the prerequisite for understanding how to create a custom function to check for hexadecimal digits.
The document provides an example program to implement a student record system using an array of structures. It involves reading the number of students and subjects, student names and marks for each subject, calculating averages and grades. The program displays menus to view all student details or a particular student's details based on roll number or name. It demonstrates declaring a structure for student records, reading input into an array of structures, calculating averages and grades, and printing the student records with options to search by roll number or name.
This document discusses writing a macro called swap(t,x,y) that swaps two arguments of any data type t. It asks the user to input a data type and two values of that type, then swaps the values and displays the output. It explains how to swap two integers by using a temporary variable and applying the same concept to arguments of any type t by using macros. The objective is to understand macro preprocessing in C.
This document discusses defining a macro called SIZEOF to return the size of a data type without using the sizeof operator. It explains that by taking the difference of the addresses of a variable and the variable plus one, cast to char pointers, you can get the size in bytes. An example is provided using an integer variable x, showing how taking the difference of (&x+1) and &x after casting to char pointers returns the size of an int, which is 4 bytes. Background on macros and pointers is provided. The objective is stated as understanding macro usage in preprocessing.
The document describes a C program to multiply two matrices. It explains that the program takes input of rows and columns for Matrix A and B, reads in the element values, and checks that the column of the first matrix equals the row of the second before calculating the product. An example is provided where the matrices can be multiplied, producing the output matrix, and another where they cannot due to mismatched dimensions. Requirements for the program include pointers, 2D arrays, and dynamic memory allocation.
The document describes an assignment to read in an unspecified number (n) of names of up to 20 characters each, sort the names alphabetically, and print the sorted list. It provides examples of reading in 3 names ("Arunachal", "Bengaluru", "Agra"), sorting them using a custom string comparison function, and printing the sorted list ("Agra", "Arunachal", "Bengaluru"). Pre-requisites for the assignment include functions, dynamic arrays, and pointers. The objective is to understand how to use functions, arrays and pointers to complete the task.
This document provides instructions for an assignment to implement fragments using an array of pointers. It asks the student to write a program that reads the number of rows and columns for each row, reads the elements for each row, calculates the average for each row, sorts the rows based on average, and prints the results. It includes examples that show reading input values, storing them in an array using pointers, calculating averages, sorting rows, and sample output. The prerequisites are listed as pointers, functions, and dynamic memory allocation, and the objective is stated as understanding dynamic memory allocation and arrays of pointers.
The document discusses implementing a function to check if a character is a hexadecimal digit. It explains that a hexadecimal digit ranges from 0-9, A-F, a-f in the ASCII table. It provides examples of inputting different characters and checking if they are hexadecimal digits or not. The sample execution section is empty. It lists functions as the prerequisite for understanding how to create a custom function to check for hexadecimal digits.
The document provides an example program to implement a student record system using an array of structures. It involves reading the number of students and subjects, student names and marks for each subject, calculating averages and grades. The program displays menus to view all student details or a particular student's details based on roll number or name. It demonstrates declaring a structure for student records, reading input into an array of structures, calculating averages and grades, and printing the student records with options to search by roll number or name.
This document discusses writing a macro called swap(t,x,y) that swaps two arguments of any data type t. It asks the user to input a data type and two values of that type, then swaps the values and displays the output. It explains how to swap two integers by using a temporary variable and applying the same concept to arguments of any type t by using macros. The objective is to understand macro preprocessing in C.
This document discusses defining a macro called SIZEOF to return the size of a data type without using the sizeof operator. It explains that by taking the difference of the addresses of a variable and the variable plus one, cast to char pointers, you can get the size in bytes. An example is provided using an integer variable x, showing how taking the difference of (&x+1) and &x after casting to char pointers returns the size of an int, which is 4 bytes. Background on macros and pointers is provided. The objective is stated as understanding macro usage in preprocessing.
The document describes a C program to multiply two matrices. It explains that the program takes input of rows and columns for Matrix A and B, reads in the element values, and checks that the column of the first matrix equals the row of the second before calculating the product. An example is provided where the matrices can be multiplied, producing the output matrix, and another where they cannot due to mismatched dimensions. Requirements for the program include pointers, 2D arrays, and dynamic memory allocation.
The document describes an assignment to read in an unspecified number (n) of names of up to 20 characters each, sort the names alphabetically, and print the sorted list. It provides examples of reading in 3 names ("Arunachal", "Bengaluru", "Agra"), sorting them using a custom string comparison function, and printing the sorted list ("Agra", "Arunachal", "Bengaluru"). Pre-requisites for the assignment include functions, dynamic arrays, and pointers. The objective is to understand how to use functions, arrays and pointers to complete the task.
This document provides instructions for an assignment to implement fragments using an array of pointers. It asks the student to write a program that reads the number of rows and columns for each row, reads the elements for each row, calculates the average for each row, sorts the rows based on average, and prints the results. It includes examples that show reading input values, storing them in an array using pointers, calculating averages, sorting rows, and sample output. The prerequisites are listed as pointers, functions, and dynamic memory allocation, and the objective is stated as understanding dynamic memory allocation and arrays of pointers.
The document describes an algorithm to generate a magic square of size n×n. It takes the integer n as input from the user and outputs the n×n magic square. A magic square is an arrangement of distinct numbers in a square grid where the sum of each row, column and diagonal is equal. The algorithm uses steps like starting from the middle of the grid and moving element by element in a pattern, wrapping around when reaching the boundaries.
This document discusses endianness and provides an example program to convert between little endian and big endian formats. It defines endianness as the order of bytes in memory, and describes little endian as having the least significant byte at the lowest memory address and big endian as the opposite. An example shows inputting a 2-byte number in little endian format and outputting it in big endian. Pre-requisites of pointers and the objective of understanding endianness representations are also stated.
The document provides steps to calculate variance of an array using dynamic memory allocation in C. It explains what variance is, shows an example to calculate variance of a sample array by finding the mean, deviations from mean, squaring the deviations and calculating the average of squared deviations. The key steps are: 1) Read array size and elements, 2) Calculate mean, 3) Find deviations from mean, 4) Square the deviations and store in another array, 5) Calculate average of squared deviations to get variance.
This document provides examples for an assignment to create a menu-driven program that stores and manipulates different data types (char, int, float, double) in dynamically allocated memory. It allocates 8 consecutive bytes to store the variables and uses flags to track which data types are stored. The menu allows the user to add, display, and remove elements as well as exit the program. Examples demonstrate initializing the flags, adding/removing elements, updating the flags, and displaying only elements whose flags are set. The objective is to understand dynamic memory allocation using pointers.
The document discusses generating non-repetitive pattern strings (NRPS) of length n using k distinct characters. It explains that an NRPS has a pattern that is not repeated consecutively. It provides steps to check if a string is an NRPS, including comparing characters and resetting a count if characters do not match. It also describes how to create an NRPS by starting with an ordered pattern and then copying subsequent characters to generate new patterns without repetition until the string reaches the desired length n. Sample inputs and outputs are provided.
The document discusses how to check if a string is a pangram, which is a sentence containing all 26 letters of the English alphabet. It provides an example of implementing the algorithm to check for a pangram by initializing an array to track letter occurrences, iterating through the input string to mark letters in the array, and checking if all letters are marked to determine if it is a pangram.
The document explains how to print all possible combinations of a given string by swapping characters. It provides an example of generating all six combinations of the string "ABC" through a step-by-step process of swapping characters. It also lists the prerequisites as strings, arrays, and pointers and the objective as understanding string manipulations.
The document describes an assignment to write a program that squeezes characters from one string (s1) that match characters in a second string (s2). It provides examples of input/output and step-by-step demonstrations of the program removing matching characters from s1. It also lists prerequisites of functions, arrays, and pointers and the objective of understanding these concepts as they relate to strings.
The document discusses implementing the strtok() string tokenization function. It explains that strtok() breaks a string into tokens based on delimiters. The document then provides pseudocode to implement a custom strtok() function by iterating through the string, overwriting delimiter characters with null terminators to create tokens, and returning a pointer to each token. Sample input/output is provided. The objective is stated as understanding string functions, with prerequisites of strings, storage classes, and pointers.
The document provides details on an assignment to write a program that recursively reverses a given string without using static variables, global variables, or loops. It includes the input, output, and examples of reversing the strings "Extreme" and "hello world". It also provides sample execution and pre-requisites of strings and recursive functions, with the objective being to understand reversing a string recursively.
The document provides code and examples for reversing a string using an iterative method in C++. It explains taking in a string as input, declaring output and input strings of the same length, and swapping the first and last characters, second and second to last, and so on through multiple iterations until the string is reversed. Examples show reversing the strings "Extreme" to "emertxE" and "hello world" to "dlrow olleh" through this iterative swap process. Pre-requisites of strings and loops are noted, with the objective stated as understanding string reversal using an iterative approach.
This document discusses implementing the itoa function, which converts an integer to a string. It provides examples of converting integers like 246, +123, and 23a7 to their string representations. The key steps are: getting each digit of the integer, converting each digit to a character, reversing the characters, and returning the string. Implementing itoa requires an understanding of functions and pointers. Sample code execution and prerequisites like functions and pointers are also outlined.
This document discusses implementing the atoi function in C, which converts a string to an integer. It provides examples of converting the strings "28", "543a", and "54a2" to integers. It also explains the steps to implement atoi by iterating through each character of the string, multiplying the value of the current character by 10 and adding it to the running integer total. The prerequisites of functions and pointers are listed, with the objective of understanding how to implement a function to convert a string to an integer.
The document discusses an assignment to write a C program to implement a getword function. The function will take a string as input, read the first word, and return the length of that word. Examples are provided showing sample inputs of strings with multiple words separated by delimiters and the expected outputs of the length of the first word. Prerequisites and objectives are listed as functions, pointers, and understanding how to use functions and pointers.
This document outlines an assignment to write a program that replaces multiple spaces in a string with a single space. It provides examples of input strings like "Welcome to Emertxe" and the expected output. It also describes the algorithm to check if the next character is a space when a space or tab is encountered, and to swap elements back one position if so. Pre-requisites like functions, pointers, arrays are listed, with the objective being to understand these concepts.
This document provides instructions and examples for an assignment to write a program that counts the number of characters, words, and lines from standard input. The program should work like the Linux 'wc' command by reading input with Ctrl-D and printing the character, word, and line counts. Examples are provided of sample inputs with the expected character counts, word counts, and line counts as output. Pre-requisites and the objective of understanding standard input/output are also stated.
This document provides an assignment to print the values of an array in sorted order without modifying or copying the array. It includes an example of taking an input array, identifying the largest and smallest values, and iteratively comparing all other values to those to print the values in sorted order. Pre-requisites mentioned are arrays, functions, pointers, and nested loops. The objective is to understand arrays, functions, and pointers.
This document provides an assignment to write a program using recursion to generate negative Fibonacci numbers. It gives the input and output requirements, which are to read an integer and print the Fibonacci numbers up to that value. It provides examples of sample runs with different inputs and expected outputs. It also gives some pre-requisites of arithmetic operators and recursions and the objective of understanding recursive functions.
This document provides an assignment to write a program to generate positive Fibonacci numbers using recursion. The program takes a number as input and outputs the Fibonacci sequence up to that number. It includes examples of running the program with different input values and the expected output. It also lists pre-requisites of arithmetic operators and recursion, and the objective of understanding recursive functions.
The document discusses writing a program to calculate the factorial of a given number using recursion without additional functions. It explains that recursion involves a function calling itself and describes using the static keyword to retain the value of the variable between recursive calls. The document provides examples of calculating factorials for different input numbers and describes sample execution and prerequisites for recursion and storage classes.
The document describes an algorithm to generate a magic square of size n×n. It takes the integer n as input from the user and outputs the n×n magic square. A magic square is an arrangement of distinct numbers in a square grid where the sum of each row, column and diagonal is equal. The algorithm uses steps like starting from the middle of the grid and moving element by element in a pattern, wrapping around when reaching the boundaries.
This document discusses endianness and provides an example program to convert between little endian and big endian formats. It defines endianness as the order of bytes in memory, and describes little endian as having the least significant byte at the lowest memory address and big endian as the opposite. An example shows inputting a 2-byte number in little endian format and outputting it in big endian. Pre-requisites of pointers and the objective of understanding endianness representations are also stated.
The document provides steps to calculate variance of an array using dynamic memory allocation in C. It explains what variance is, shows an example to calculate variance of a sample array by finding the mean, deviations from mean, squaring the deviations and calculating the average of squared deviations. The key steps are: 1) Read array size and elements, 2) Calculate mean, 3) Find deviations from mean, 4) Square the deviations and store in another array, 5) Calculate average of squared deviations to get variance.
This document provides examples for an assignment to create a menu-driven program that stores and manipulates different data types (char, int, float, double) in dynamically allocated memory. It allocates 8 consecutive bytes to store the variables and uses flags to track which data types are stored. The menu allows the user to add, display, and remove elements as well as exit the program. Examples demonstrate initializing the flags, adding/removing elements, updating the flags, and displaying only elements whose flags are set. The objective is to understand dynamic memory allocation using pointers.
The document discusses generating non-repetitive pattern strings (NRPS) of length n using k distinct characters. It explains that an NRPS has a pattern that is not repeated consecutively. It provides steps to check if a string is an NRPS, including comparing characters and resetting a count if characters do not match. It also describes how to create an NRPS by starting with an ordered pattern and then copying subsequent characters to generate new patterns without repetition until the string reaches the desired length n. Sample inputs and outputs are provided.
The document discusses how to check if a string is a pangram, which is a sentence containing all 26 letters of the English alphabet. It provides an example of implementing the algorithm to check for a pangram by initializing an array to track letter occurrences, iterating through the input string to mark letters in the array, and checking if all letters are marked to determine if it is a pangram.
The document explains how to print all possible combinations of a given string by swapping characters. It provides an example of generating all six combinations of the string "ABC" through a step-by-step process of swapping characters. It also lists the prerequisites as strings, arrays, and pointers and the objective as understanding string manipulations.
The document describes an assignment to write a program that squeezes characters from one string (s1) that match characters in a second string (s2). It provides examples of input/output and step-by-step demonstrations of the program removing matching characters from s1. It also lists prerequisites of functions, arrays, and pointers and the objective of understanding these concepts as they relate to strings.
The document discusses implementing the strtok() string tokenization function. It explains that strtok() breaks a string into tokens based on delimiters. The document then provides pseudocode to implement a custom strtok() function by iterating through the string, overwriting delimiter characters with null terminators to create tokens, and returning a pointer to each token. Sample input/output is provided. The objective is stated as understanding string functions, with prerequisites of strings, storage classes, and pointers.
The document provides details on an assignment to write a program that recursively reverses a given string without using static variables, global variables, or loops. It includes the input, output, and examples of reversing the strings "Extreme" and "hello world". It also provides sample execution and pre-requisites of strings and recursive functions, with the objective being to understand reversing a string recursively.
The document provides code and examples for reversing a string using an iterative method in C++. It explains taking in a string as input, declaring output and input strings of the same length, and swapping the first and last characters, second and second to last, and so on through multiple iterations until the string is reversed. Examples show reversing the strings "Extreme" to "emertxE" and "hello world" to "dlrow olleh" through this iterative swap process. Pre-requisites of strings and loops are noted, with the objective stated as understanding string reversal using an iterative approach.
This document discusses implementing the itoa function, which converts an integer to a string. It provides examples of converting integers like 246, +123, and 23a7 to their string representations. The key steps are: getting each digit of the integer, converting each digit to a character, reversing the characters, and returning the string. Implementing itoa requires an understanding of functions and pointers. Sample code execution and prerequisites like functions and pointers are also outlined.
This document discusses implementing the atoi function in C, which converts a string to an integer. It provides examples of converting the strings "28", "543a", and "54a2" to integers. It also explains the steps to implement atoi by iterating through each character of the string, multiplying the value of the current character by 10 and adding it to the running integer total. The prerequisites of functions and pointers are listed, with the objective of understanding how to implement a function to convert a string to an integer.
The document discusses an assignment to write a C program to implement a getword function. The function will take a string as input, read the first word, and return the length of that word. Examples are provided showing sample inputs of strings with multiple words separated by delimiters and the expected outputs of the length of the first word. Prerequisites and objectives are listed as functions, pointers, and understanding how to use functions and pointers.
This document outlines an assignment to write a program that replaces multiple spaces in a string with a single space. It provides examples of input strings like "Welcome to Emertxe" and the expected output. It also describes the algorithm to check if the next character is a space when a space or tab is encountered, and to swap elements back one position if so. Pre-requisites like functions, pointers, arrays are listed, with the objective being to understand these concepts.
This document provides instructions and examples for an assignment to write a program that counts the number of characters, words, and lines from standard input. The program should work like the Linux 'wc' command by reading input with Ctrl-D and printing the character, word, and line counts. Examples are provided of sample inputs with the expected character counts, word counts, and line counts as output. Pre-requisites and the objective of understanding standard input/output are also stated.
This document provides an assignment to print the values of an array in sorted order without modifying or copying the array. It includes an example of taking an input array, identifying the largest and smallest values, and iteratively comparing all other values to those to print the values in sorted order. Pre-requisites mentioned are arrays, functions, pointers, and nested loops. The objective is to understand arrays, functions, and pointers.
This document provides an assignment to write a program using recursion to generate negative Fibonacci numbers. It gives the input and output requirements, which are to read an integer and print the Fibonacci numbers up to that value. It provides examples of sample runs with different inputs and expected outputs. It also gives some pre-requisites of arithmetic operators and recursions and the objective of understanding recursive functions.
This document provides an assignment to write a program to generate positive Fibonacci numbers using recursion. The program takes a number as input and outputs the Fibonacci sequence up to that number. It includes examples of running the program with different input values and the expected output. It also lists pre-requisites of arithmetic operators and recursion, and the objective of understanding recursive functions.
The document discusses writing a program to calculate the factorial of a given number using recursion without additional functions. It explains that recursion involves a function calling itself and describes using the static keyword to retain the value of the variable between recursive calls. The document provides examples of calculating factorials for different input numbers and describes sample execution and prerequisites for recursion and storage classes.
More from Emertxe Information Technologies Pvt Ltd (20)
Temple of Asclepius in Thrace. Excavation resultsKrassimira Luka
The temple and the sanctuary around were dedicated to Asklepios Zmidrenus. This name has been known since 1875 when an inscription dedicated to him was discovered in Rome. The inscription is dated in 227 AD and was left by soldiers originating from the city of Philippopolis (modern Plovdiv).
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxEduSkills OECD
Iván Bornacelly, Policy Analyst at the OECD Centre for Skills, OECD, presents at the webinar 'Tackling job market gaps with a skills-first approach' on 12 June 2024
Leveraging Generative AI to Drive Nonprofit InnovationTechSoup
In this webinar, participants learned how to utilize Generative AI to streamline operations and elevate member engagement. Amazon Web Service experts provided a customer specific use cases and dived into low/no-code tools that are quick and easy to deploy through Amazon Web Service (AWS.)
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...TechSoup
Whether you're new to SEO or looking to refine your existing strategies, this webinar will provide you with actionable insights and practical tips to elevate your nonprofit's online presence.