The document discusses various C programming concepts including:
1. It provides an example program to calculate the area of a circle using #define and shows how to conditionally compile code blocks using #if, #elif, #else and #endif.
2. It explains that the C preprocessor transforms code before compilation by allowing users to define macros and includes several built-in preprocessor directives like #include, #define, and #if.
3. It discusses static and dynamic memory allocation in C, listing functions like malloc(), calloc(), free(), and realloc() for dynamic allocation and provides examples of their use.
In computer science, a pointer is a programming language object, whose value refers to (or "points to") another value stored elsewhere in the computer memory using its memory address. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer.
A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before you can use it to store any variable address.
There are few important operations, which we will do with the help of pointers very frequently. (a) we define a pointer variable (b) assign the address of a variable to a pointer and (c) finally access the value at the address available in the pointer variable. This is done by using unary operator * that returns the value of the variable located at the address specified by its operand.
C lecture 4 nested loops and jumping statements slideshareGagan Deep
Nested Loops and Jumping Statements(Loop Control Statements), Goto statement in C, Return Statement in C Exit statement in C, For Loops with Nested Loops, While Loop with Nested Loop, Do-While Loop with Nested Loops, Break Statement, Continue Statement : visit us at : www.rozyph.com
In computer science, a pointer is a programming language object, whose value refers to (or "points to") another value stored elsewhere in the computer memory using its memory address. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer.
A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before you can use it to store any variable address.
There are few important operations, which we will do with the help of pointers very frequently. (a) we define a pointer variable (b) assign the address of a variable to a pointer and (c) finally access the value at the address available in the pointer variable. This is done by using unary operator * that returns the value of the variable located at the address specified by its operand.
C lecture 4 nested loops and jumping statements slideshareGagan Deep
Nested Loops and Jumping Statements(Loop Control Statements), Goto statement in C, Return Statement in C Exit statement in C, For Loops with Nested Loops, While Loop with Nested Loop, Do-While Loop with Nested Loops, Break Statement, Continue Statement : visit us at : www.rozyph.com
Concept of file, Opening and closing of file, Modes, Input/ output function, Random access in file, Printing a file
A file represents a sequence of bytes on the disk where a group of related data is stored. File is created for permanent storage of data. It is a ready made structure.
In C language, we use a structure pointer of file type to declare a file.....
Online storefront creation: A business creates an online storefront, which serves as its virtual shop where customers can browse products or services, place orders, and make payments.
Product listing: The business lists its products or services on the online storefront, along with relevant information such as price, product description, and images.
Payment gateway integration: The business integrates a payment gateway into its online storefront, which allows customers to securely make payments online using credit cards, debit cards, or other payment methods.
Order processing: When a customer places an order, the business receives the order information through the online storefront. The business then processes the order, which may involve verifying the availability of the product, preparing the product for shipping, and generating a shipping label.
Shipping and delivery: The business ships the product to the customer's address using a third-party logistics provider or its own delivery service. The customer is provided with tracking information to monitor the status of the shipment.
Customer service: The business provides customer service to address any issues or concerns that the customer may have regarding the product or service.
Example:
Let's take the example of a clothing store that sells its products online through its e-commerce website. The store creates an online storefront and lists its products, which include dresses, shirts, pants, and accessories. Customers can browse the products, select the items they wish to purchase, and make payments online using a payment gateway such as PayPal or Stripe.
Once the order is received, the store processes the order and prepares the product for shipping. The product is then shipped to the customer's address using a logistics provider such as FedEx or UPS. The customer can track the shipment using the tracking information provided by the store.
If the customer is not satisfied with the product, they can contact the store's customer service and initiate a return or exchange. The store handles the return or exchange process and ensures that the customer is satisfied with their purchase.
HEAP SORT ILLUSTRATED WITH HEAPIFY, BUILD HEAP FOR DYNAMIC ARRAYS.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the minimum element and place the minimum element at the beginning. Repeat the same process for the remaining elements.
Understanding Inductive Bias in Machine LearningSUTEJAS
This presentation explores the concept of inductive bias in machine learning. It explains how algorithms come with built-in assumptions and preferences that guide the learning process. You'll learn about the different types of inductive bias and how they can impact the performance and generalizability of machine learning models.
The presentation also covers the positive and negative aspects of inductive bias, along with strategies for mitigating potential drawbacks. We'll explore examples of how bias manifests in algorithms like neural networks and decision trees.
By understanding inductive bias, you can gain valuable insights into how machine learning models work and make informed decisions when building and deploying them.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Online aptitude test management system project report.pdfKamal Acharya
The purpose of on-line aptitude test system is to take online test in an efficient manner and no time wasting for checking the paper. The main objective of on-line aptitude test system is to efficiently evaluate the candidate thoroughly through a fully automated system that not only saves lot of time but also gives fast results. For students they give papers according to their convenience and time and there is no need of using extra thing like paper, pen etc. This can be used in educational institutions as well as in corporate world. Can be used anywhere any time as it is a web based application (user Location doesn’t matter). No restriction that examiner has to be present when the candidate takes the test.
Every time when lecturers/professors need to conduct examinations they have to sit down think about the questions and then create a whole new set of questions for each and every exam. In some cases the professor may want to give an open book online exam that is the student can take the exam any time anywhere, but the student might have to answer the questions in a limited time period. The professor may want to change the sequence of questions for every student. The problem that a student has is whenever a date for the exam is declared the student has to take it and there is no way he can take it at some other time. This project will create an interface for the examiner to create and store questions in a repository. It will also create an interface for the student to take examinations at his convenience and the questions and/or exams may be timed. Thereby creating an application which can be used by examiners and examinee’s simultaneously.
Examination System is very useful for Teachers/Professors. As in the teaching profession, you are responsible for writing question papers. In the conventional method, you write the question paper on paper, keep question papers separate from answers and all this information you have to keep in a locker to avoid unauthorized access. Using the Examination System you can create a question paper and everything will be written to a single exam file in encrypted format. You can set the General and Administrator password to avoid unauthorized access to your question paper. Every time you start the examination, the program shuffles all the questions and selects them randomly from the database, which reduces the chances of memorizing the questions.
Hierarchical Digital Twin of a Naval Power SystemKerry Sado
A hierarchical digital twin of a Naval DC power system has been developed and experimentally verified. Similar to other state-of-the-art digital twins, this technology creates a digital replica of the physical system executed in real-time or faster, which can modify hardware controls. However, its advantage stems from distributing computational efforts by utilizing a hierarchical structure composed of lower-level digital twin blocks and a higher-level system digital twin. Each digital twin block is associated with a physical subsystem of the hardware and communicates with a singular system digital twin, which creates a system-level response. By extracting information from each level of the hierarchy, power system controls of the hardware were reconfigured autonomously. This hierarchical digital twin development offers several advantages over other digital twins, particularly in the field of naval power systems. The hierarchical structure allows for greater computational efficiency and scalability while the ability to autonomously reconfigure hardware controls offers increased flexibility and responsiveness. The hierarchical decomposition and models utilized were well aligned with the physical twin, as indicated by the maximum deviations between the developed digital twin hierarchy and the hardware.
Using recycled concrete aggregates (RCA) for pavements is crucial to achieving sustainability. Implementing RCA for new pavement can minimize carbon footprint, conserve natural resources, reduce harmful emissions, and lower life cycle costs. Compared to natural aggregate (NA), RCA pavement has fewer comprehensive studies and sustainability assessments.
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
An Approach to Detecting Writing Styles Based on Clustering Techniquesambekarshweta25
An Approach to Detecting Writing Styles Based on Clustering Techniques
Authors:
-Devkinandan Jagtap
-Shweta Ambekar
-Harshit Singh
-Nakul Sharma (Assistant Professor)
Institution:
VIIT Pune, India
Abstract:
This paper proposes a system to differentiate between human-generated and AI-generated texts using stylometric analysis. The system analyzes text files and classifies writing styles by employing various clustering algorithms, such as k-means, k-means++, hierarchical, and DBSCAN. The effectiveness of these algorithms is measured using silhouette scores. The system successfully identifies distinct writing styles within documents, demonstrating its potential for plagiarism detection.
Introduction:
Stylometry, the study of linguistic and structural features in texts, is used for tasks like plagiarism detection, genre separation, and author verification. This paper leverages stylometric analysis to identify different writing styles and improve plagiarism detection methods.
Methodology:
The system includes data collection, preprocessing, feature extraction, dimensional reduction, machine learning models for clustering, and performance comparison using silhouette scores. Feature extraction focuses on lexical features, vocabulary richness, and readability scores. The study uses a small dataset of texts from various authors and employs algorithms like k-means, k-means++, hierarchical clustering, and DBSCAN for clustering.
Results:
Experiments show that the system effectively identifies writing styles, with silhouette scores indicating reasonable to strong clustering when k=2. As the number of clusters increases, the silhouette scores decrease, indicating a drop in accuracy. K-means and k-means++ perform similarly, while hierarchical clustering is less optimized.
Conclusion and Future Work:
The system works well for distinguishing writing styles with two clusters but becomes less accurate as the number of clusters increases. Future research could focus on adding more parameters and optimizing the methodology to improve accuracy with higher cluster values. This system can enhance existing plagiarism detection tools, especially in academic settings.
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesChristina Lin
Traditionally, dealing with real-time data pipelines has involved significant overhead, even for straightforward tasks like data transformation or masking. However, in this talk, we’ll venture into the dynamic realm of WebAssembly (WASM) and discover how it can revolutionize the creation of stateless streaming pipelines within a Kafka (Redpanda) broker. These pipelines are adept at managing low-latency, high-data-volume scenarios.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Pointers and call by value, reference, address in C
1. Programming in C –Call By
Prof. A. Syed Mustafa, HKBK College of Engineering
Program to find area of a circle using #define.
#include<stdio.h>
#define PI 3.1412
int main()
{
int radius; float area;
printf("Enter the radius: ");
scanf("%d", &radius);
area=PI*radius*radius;
printf("Area=%.2f",area);
return 0;
}
Use of #if, #elif, #else and #endif :
The preprocessor directives #if, #elif, #else and #endif allows to
conditionally compile a block of code based on predefined symbols.
#include<stdio.h>
#define MAX 100
void main( )
{
#if (MAX)
printf("MAX is defined");
#else
printf ("MAX is not defined");
#endif
}
Preprocessor Directive / Macros
The C preprocessor [CPP] is a macro processor that is used
automatically by the C compiler to transform programmer defined
programs before actual compilation takes place. It is called a macro
processor because it allows the user to define macros, which are short
abbreviations for longer constructs.
It instructs the compiler to do required pre-processing before the
actual compilation. All preprocessor directives begin with the #
symbol (known as pound or hash).
List of pre-processor directives:
1. #include: This is used insert a particular header from another file.
2. #define, #undef : These are used to define and un-define
conditional compilation symbols.
3. #if, #elif, #else, #endif : These are used to conditionally skip
sections of source code.
Example:
#include “demo.h”
tells CPP to get demo.h from the local directory and add the
content to the current source file.
#define PI 3.1412 /* defines symbolic constant */
This directive tells the CPP to replace symbolic constant pi
with 3.1412.
#define SIZE 5 /* SIZE will be replaced with 5 */
2. Programming in C –Call By
Prof. A. Syed Mustafa, HKBK College of Engineering
MEMORY ALLOCATION FUNCTIONS
1. Static Memory Allocation:
Memory space allocated from stack at compile time for variables
declared in the program is fixed, it cannot be altered during
execution-time. This is called static memory allocation.
Example: int a[5]; float d;
2. Dynamic Memory Allocation
It is the process of allocating memory-space during execution-time
i.e. run time from Heap. If there is an unpredictable storage
requirement, then the dynamic allocation technique is used.
This allocation technique uses predefined functions to allocate and
release memory for data during execution-time.
There are 4 library functions for dynamic memory allocation:
malloc( ), calloc( ), free( ), realloc( )
These library functions are defined under "stdlib.h"
1. malloc( ) -memory allocation
This function is used to allocate the required memory-space
during execution-time.
The syntax is shown below:
data_type *p;
p=(data_type*)malloc(size);
Here p is pointer variable.
data_type can be int, float or char. size is number of bytes to be
allocated.If memory is successfully allocated, then address of the first
byte of allocated space is returned. If memory allocation fails, then
NULL is returned.
For ex: int *ptr;
ptr=(int*)malloc(100*sizeof(int));
The above code will allocate 200 bytes assuming sizeof(int)=2 bytes.
2. calloc( ) - contiguous allocation
This function is used to allocate the required memory-size during
execution-time and at the same time, automatically initialize
memory with 0's.
syntax :
data_type *p;
p=(data_type*)calloc(n,size);
Ex:
p=(int*)calloc(25,sizeof(int));
3. free( )
Dynamically allocated memory with either calloc( ) or malloc( ) can
be deallocated using free( ) explicitly to release space.
syntax:
free(ptr);
4. realloc() -reallocation
If the previously allocated memory is insufficient or more than
sufficient. Then, we can change memory-size previously allocated
using realloc().
The syntax is shown below:
ptr=(data_type*)realloc(ptr,newsize);
void main( )
{ int i;
int *a= (int *)malloc(10);
for(i=0;i<5;i++)
*(a+i)=i+10;
for(i=0;i<5;i++)
printf(“%dt”,*(a+i)10;
}
Output: 10 11 12 13 14
3. Programming in C –Call By
Prof. A. Syed Mustafa, HKBK College of Engineering
Pointers
A Pointer is just an address of the data stored in memory.
A pointer is a variable whose value is the address of
another variable, i.e., direct address of the memory
location.
Syntax: <variable_type> *<name>=&variable; eg:- int *a=&b;
‘*’ used to declare a pointer variable and also used to retrieve the value
from the pointed memory location. ‘*’ is also called as derefence operator.
#include <stdio.h>
void main ()
{
int a = 20; /* actual variable declaration */
int *ip; /* pointer variable declaration */
ip = &a; /* store address of var in pointer variable*/
printf("Address of variable a is: %xn", &a );
/* address stored in pointer variable */
printf("Address stored in variable ip is: %xn", ip );
/* access the value using the pointer */
printf("Value of *ip variable: %dn", *ip );
}
Output:
Address of variable a is: bffd8b3c
Address stored in variable ip is: bffd8b3c
Value of *ip variable: 20
Actual Parameter
The parameter’s value (or arguments) we provide while calling
a function is known as actual arguments.
Parameter Written In Function Call is Called “Actual Parameter”
Actual parameters are parameters as they appear in function calls.
The actual value that is passed into the function by a caller.
Formal Parameter
Formal parameters are parameters as they appear in function
declarations.
the identifier used in a method to stand for the value that is passed
into the function by a caller.
Parameter Written In Function Definition is Called “Formal Parameter”
While declaring a function, the arguments list of parameters we
specify are known as formal parameters.
Example
4. Programming in C –Call By
Prof. A. Syed Mustafa, HKBK College of Engineering
CALL BY ADDRESS
The call to the function passes variable’s
address to the called function. The actual
arguments are not copied to the formal
arguments, the addresses of actual
arguments (or parameters) are passed to
the formal parameters. Hence any
operation performed by function on
formal arguments / parameters affects
actual parameters.
void swap(int *x, int *y)
{ int t=*x; *x=*y; *y=t;
}
void main( ) {
int a=5, b=10 ;
printf("Before swap: a=%d,b=%d",a,b);
swap(&a,&b); /*calling swap function*/
printf("After swap: a= %d,b=%d",a,b);
}
Output:
Before swap: a=5,b=10
After swap: a=10,b=5
Because variable declared ‘a’, ‘b’ in
main() is different from variable ‘x’, ’y’ in
swap(). Only variable names are
different but both a and x, b and y point
to the same memory address locations
respectively.
CALL BY REFERENCE
The call to the function passes base address to
the called function. The actual arguments are
not copied to the formal arguments, only
referencing is made. Hence any operation
performed by function on formal arguments /
parameters affects actual parameters.
void change(int b[ ])
{
b[0]=10; b[1]=20; b[2]=30;
}
void main( )
{
int a[3]={ 5, 15, 25 } ;
printf("BeforeChange:%d,%d,%d",a[0],a[1],a[2]);
change(a); /*calling swap function*/
printf("AfterChange:%d,%d,%d",a[0],a[1],a[2]);
}
Output:
BeforeChange: 5,15,25
AfterChange: 10,20,30
Because array variable declared ‘b’ in change() is
referencing/ pointing to array variable ‘a’ in
main(). Only variable name is different but
both are pointing / referencing to same
memory address locations.
CALL BY VALUE
The call to the function passes either the values
or the normal variables to the called function.
The actual arguments are copied to the formal
arguments, hence any operation performed by
function on arguments doesn’t affect actual
parameters.
void swap(int a, int b)
{
int t=a; a=b; b=t;
}
void main( )
{
int a=5, b=10 ;
printf("Before swap: a=%d,b=%d",a,b);
swap(a,b); /*calling swap function*/
printf("After swap: a= %d,b=%d",a,b);
}
Output:
Before swap: a=5,b=10
After swap: a=5,b=10
Because variable declared ‘a’, ‘b’ in main() is
different from variable ‘a’, ’b’ in swap(). Only
variable names are similar but their memory
address are different and stored in different
memory locations.
5. Programming in C –Call By
Prof. A. Syed Mustafa, HKBK College of Engineering
STACKS
• A stack is a special type of data structure where elements are inserted from one end and elements are deleted from the same
end.
• Using this approach, the Last element Inserted is the First element to be deleted Out, and hence, stack is also called LIFO data
structure.
• The various operations performed on stack:
Insert: An element is inserted from top end. Insertion operation is called push operation. Delete: An element is
deleted from top end. Deletion operation is called pop operation. Overflow: Check whether the stack is full or not.
Underflow: Check whether the stack is empty or not.
• This can be pictorially represented as shown below:
APPLICATIONS OF STACK
1) Conversion of expressions: The compiler converts the infix expressions into postfix expressions using stack.
2) Evaluation of expression: An arithmetic expression represented in the form of either postfix or prefix can be easily evaluated
using stack.
3) Recursion: A function which calls itself is called recursive function.
4) Other applications: To find whether the string is a palindrome, to check whether a given expression is valid or not.
6. Programming in C –Call By
Prof. A. Syed Mustafa, HKBK College of Engineering
PRIMITIVE AND NON-PRIMITIVE DATA TYPES
Data type specifies the type of data stored in a
variable. The data type can be classified into two
types: 1) Primitive data type and 2)Non-Primitive data
type
Primitive Data Type
• The primitive data types are the basic data types
that are available in most of the programming
languages.
• The primitive data types are used to represent single
values.
Integer: This is used to represent a number without
decimal point. Eg: int a=12;
Float: This is used to represent a number with
decimal point. Eg: float a=45.1; double b=67.3;
Character: This is used to represent single character
Eg: char ch=‘C’; char ch1= ‘a’;
Non Primitive Data Type
• The data types that are derived from primary data types
are known as non-Primitive data types.
• These datatypes are used to store group of values.
• The non-primitive data types are
Arrays, Structure
Stacks, Linked list
Queue, Binary tree