Premium Essay

Let Us C

In:

Submitted By Chauhanashish
Words 46651
Pages 187
Let Us C
Fifth Edition

Yashavant P. Kanetkar

Dedicated to baba Who couldn’t be here to see this day...

About the Author
Destiny drew Yashavant Kanetkar towards computers when the IT industry was just making a beginning in India. Having completed his education from VJTI Mumbai and IIT Kanpur in Mechanical Engineering he started his training company in Nagpur. Yashavant has a passion for writing and is an author of several books in C, C++, VC++, C#, .NET, DirectX and COM programming. He is a much sought after speaker on various technology subjects and is a regular columnist for Express Computers and Developer 2.0. His current affiliations include being a Director of KICIT, a training company and DCube Software Technologies, a software development company. In recognition to his contribution Microsoft awarded him the prestigious “Best .NET Technical Contributor” award recently. He can be reached at kanetkar@kicit.com.

Acknowledgments
It has been a journey of almost a decade from the stage the book idea of “Let Us C” was conceived up to the release of this Fifth Edition. During this journey I have met so many students, developers, professors, publishers and authors who expressed their opinions about Let Us C. They have been the main motivators in my effort to continuously improve this book. In particular I am indebted to Manish Jain who had a faith in this book idea, believed in my writing ability, whispered the words of encouragement and made helpful suggestions from time to time. The five editions of this book saw several changes and facelifts. During this course people like Ajay Joshi, Amol Tambat, Ajay Daga, Nandita Shastri, Mrunal Khandekar and Rahul Bedge helped in writing programs, spotting bugs, drawing figures and preparing index. I trust that with their collective acumen all the programs would run correctly in all situations. Anup Das, my

Similar Documents

Premium Essay

Let Us C - Yashwant Kanetkar.Pdf

...Let Us C Fifth Edition Yashavant P. Kanetkar Dedicated to baba Who couldn’t be here to see this day... About the Author Destiny drew Yashavant Kanetkar towards computers when the IT industry was just making a beginning in India. Having completed his education from VJTI Mumbai and IIT Kanpur in Mechanical Engineering he started his training company in Nagpur. Yashavant has a passion for writing and is an author of several books in C, C++, VC++, C#, .NET, DirectX and COM programming. He is a much sought after speaker on various technology subjects and is a regular columnist for Express Computers and Developer 2.0. His current affiliations include being a Director of KICIT, a training company and DCube Software Technologies, a software development company. In recognition to his contribution Microsoft awarded him the prestigious “Best .NET Technical Contributor” award recently. He can be reached at kanetkar@kicit.com. Preface to the Fifth Edition It is mid 2004. World has left behind the DOTCOM bust, 9/11 tragedy, the economic downturn, etc. and moved on. Countless Indians have relentlessly worked for close to two decades to successfully establish “India” as a software brand. At times I take secret pleasure in seeing that a book that I have been part of, has contributed in its own little way in shaping so many budding careers that have made the “India” brand acceptable. Computing and the way people use C for doing it keeps changing as years go by. So overwhelming...

Words: 46379 - Pages: 186

Free Essay

C Book

...Let Us C Fifth Edition Yashavant P. Kanetkar Dedicated to baba Who couldn’t be here to see this day... About the Author Destiny drew Yashavant Kanetkar towards computers when the IT industry was just making a beginning in India. Having completed his education from VJTI Mumbai and IIT Kanpur in Mechanical Engineering he started his training company in Nagpur. Yashavant has a passion for writing and is an author of several books in C, C++, VC++, C#, .NET, DirectX and COM programming. He is a much sought after speaker on various technology subjects and is a regular columnist for Express Computers and Developer 2.0. His current affiliations include being a Director of KICIT, a training company and DCube Software Technologies, a software development company. In recognition to his contribution Microsoft awarded him the prestigious “Best .NET Technical Contributor” award recently. He can be reached at kanetkar@kicit.com. Acknowledgments It has been a journey of almost a decade from the stage the book idea of “Let Us C” was conceived up to the release of this Fifth Edition. During this journey I have met so many students, developers, professors, publishers and authors who expressed their opinions about Let Us C. They have been the main motivators in my effort to continuously improve this book. In particular I am indebted to Manish Jain who had a faith in this book idea, believed in my writing ability, whispered the words of encouragement and made helpful suggestions...

Words: 46741 - Pages: 187

Premium Essay

Discrete Mathematics

...are packed without any gaps and can not be separated from their immediate neighbors. In that sense they are not discrete. In this course we will be concerned with objects such as integers, propositions, sets, relations and functions, which are all discrete. We are going to learn concepts associated with them, their properties, and relationships among them among others.  Why Discrete Mathematics ?  Let us first see why we want to be interested in the formal/theoretical approaches in computer science.  Some of the major reasons that we adopt formal approaches are 1) we can handle infinity or large quantity and indefiniteness with them, and 2) results from formal approaches are reusable.  As an example, let us consider a simple problem of investment. Suppose that we invest $1,000 every year with expected return of 10% a year. How much are we going to have after 3 years, 5 years, or 10 years ? The most naive way to find that out would be the brute force calculation.  Let us see what happens to $1,000 invested at the beginning of each year for three years.  First let us consider the $1,000 invested at the beginning of the first year. After one year it produces a return of $100. Thus at the beginning of the second year,...

Words: 5418 - Pages: 22

Premium Essay

Investigatory Project

...Dorog III-Humility Royals Verse 1 D I've never seen a diamond in the flesh C G I cut my teeth on wedding rings in the movies D C And I'm not proud of my address - in the torn up town G No postcode envy Chorus D But every song's like: gold teeth, grey goose, trippin' in the bathroom Blood stains, ballgowns, trashin' the hotel room C G We don't care - we're driving Cadillacs in our dreams D But everybody's like Cristal, Mayback, diamonds on your timepiece Jet planes, islands, tigers on a gold leash C G We don't care - we aren't caught up in your love affair D And we'll never be royals - It don't run in our blood C That kind of lux just ain't for us G We crave a different kind of buzz D Let me be your ruler - you can call me Queen Bee C And baby I'll rule, I'll rule, I'll rule, I'll rule G D Let me live that fantasy Verse 2 D My friends and I we've cracked the code C G We count our dollars on the train to the party D C And everyone who knows us knows that we're fine with this G We didn't...

Words: 711 - Pages: 3

Free Essay

Fundamental Theorem of Algebra

...non-constant single-variable polynomial with complex coefficients has at least one complex root. This includes polynomials with real coefficients, since every real number is a complex number with zero imaginary part. PROOF: This is an algebraic proof. I am doing this for a 2 degree polynomial . It can be extended for any degree polynomial. We know that the roots of a quadratic equation az 2 + bz + c = 0 are given by the formula irrespective of the fact whether a, b, c are real or complex numbers. Also it is clear that in this case there are two roots, say α + β = −b/a, αβ = c/a and az 2 + bz + c = a(z − α)(z − β) . Also any α, β satisfying α + β = a, αβ = b are given as roots of the quadratic equation z 2 − az + b = 0 . Now we will show that in order to prove the fundamental theorem of algebra it is sufficient to prove that any non-constant polynomial with real coefficients has a complex root. Let us then assume that every non-constant polynomial with real coefficients has a complex root. Let f (z) = a0 z n + a1 z n−1 + ⋯ + an−1 z + an be a polynomial with complex coefficients. Let g(z) be the polynomial obtained from f (z) by replacing the coefficients with their conjugates. Clearly the polynomial h(z) = f (z)g(z) has real coefficients and hence has a complex root α. Now h(α) = 0 implies that f (α)g(α) = 0 so that either f (α) = 0 or g(α) = 0. If f (α) = 0 then f (z) has a complex root α. On the other hand if g(α) = 0 then a0 αn + a1 αn−1 + ⋯ + an−1 α + an = 0 ⇒ a0 αn + a1...

Words: 557 - Pages: 3

Free Essay

Lesson Plan

...Detailed Lesson Plan in Mathematics-II Prepared by : I. Objectives: At the end of 70 minutes class discussion, the Grade-II pupils are expected to do the following with atleast 75% proficiency level. a. Describe shapes according to the number of sides and corners. b. Write the appropriate name of the shapes. c. Cooperate during group shared activity. II. Subject Matter: a. Topic: Common Shapes b. Reference: BEC-PELC III. A-21 21st century Mathematics-II By: Roberto J. Degolacion c. Materials: Cutouts of different shapes, cartolina and real objects d. Values Infusion: Cooperation III. Procedure TEACHER’S ACTIVITY | PUPIL’S ACTIVITY | A. Preparatory Activities 1. Prayer * For us to start our class this morning may I request everybody to please rise for our prayer. (The teacher will call the name of the pupil to lead a prayer.) 2. Greetings * Good morning children! 3. Action Song 4. Checking of Attendance * . 5. Checking of Assignment 6. Drill * Using flashcards, the pupils will read the words being shown/ flash to them. (The teacher will read first before the pupils.) * After they read the words, every row should read again. ( rectangle, square, triangle and circle) 7. Review 8. Motivation * (The teacher will show a picture to the class.) * Okay children what have you observe from this picture? * Excellent! B. Developmental Activities 1. Presentation * And now children, based on...

Words: 1306 - Pages: 6

Premium Essay

Finance Management

...5 marks each. Part One: Multiple choices: 1. Foreign exchange market in India is relatively very ________. a. Big b. Small c. Medium d. None of the above 2. Balance of payment is a systematic record of all _______ during a given period of time. a. Political transactions b. Social transactions c. Economic transactions d. None of the above 3. Merchandise trade balance, services balance & balance on unilateral transfer are the part of ________ account. a. Current account b. Capital account c. Official account d. None of the above 4. Interest rate swaps can be explained as an agreement between _________ parties. a. One b. Two c. Three d. None of the above 5. Capital account convertibility in India evolved in August a. 1996 b. 1995 c. 1994 d. None of the above 6. Interest rate parity is an economic concept, expressed as a basic algebraic identity that relates. a. Capital rate & interest rate b. Interest rate & exchange rate Examination Paper of Finance Management 2 IIBM Institute of Business Management c. Currency rate & exchange rate d. None of the above 7. The two kind of swap in the forward market are_________ a. Forward & reverse swap b. Reverse swap & option swap c. Forward & option less swap d. Forward swap & option swap 8. FEMA stands for_________ a. Forward exchange market b. Future exchange market c. Foreign exchange management act d. None of the above 9. Exchange rate quotation methods are________ a. Direct and direct b. Indirect...

Words: 1072 - Pages: 5

Free Essay

Hunger

...crisis that hit the US. III. Investigated topic. A. Studied issue B. Done Research IV. Present effects of Hunger. V. Our quality of life and humanity is being threatened VI. Later, there will be a Q/A period. VII. Let me preview my points A. Problem- Hunger in the US B. Solution- Food banks C. Advantages (Transition: Let’s look at the problem- Hunger in the US) Body I. Statement of problem: Hunger is threatening our quality of life and humanity. A. As sited as on Feeding America website, 48.1 million Americans live in food insecure households, including 32.8 million adults and 15.3 million children. B. Causes of the problem 1. Financial constraints 2. According to dosomething.org, In the US, hunger isn’t caused by a lack of food, but rather the continued prevalence of poverty. C. Effects of the problem 1. Quality of life harmed. 2. Threat to life itself, (Transition: Being aware of the causes and effects of the problem, now I’ll present you with a viable solution) II. Statement of solution: Let’s turn to donating money, food and time to food banks, such as Stop Hunger Now. A. According Stop Hunger Now website B. Details 1. They distribute meals C. Progress 1. Since their founding in 1998, they have provided over 225 million meals III. Advantages (and/or disadvantages) A. Increased life quality B. Increased social well being Conclusion I. In conclusion, let me summarize... A. Problem- Hunger in the US B. Solution- Food banks C. Advantages gained ...

Words: 371 - Pages: 2

Free Essay

Direct Porposeful

...Direct purposeful experience — Presentation Transcript Direct Purposeful Experience By: Jeraldyn C. Abellano C. BSEd II- A Definition:-These are the rich experiences that our senses bring. Weconstruct the ideas , the generalizations that give meaning andorder to our lives.-These are the concrete and first handexperiences that make upthe foundation of our learning. They are the sensory experiences. They are experiences that are internalized in the sense that theseexperiences involve the asking of questions that have significancein the life of the person undergoing the direct experience.Besides, these experiences are undergone in relation to a purpose,,,ex. learningPurposeful because the experiences are not purely mechanical.They are not a matter of going through the motion.3. Why are these experiences described to be purposeful? AIM: To develop higher level thinking skills.It leads us to concept formation and abstraction.It serves as the foundation of concept formation, generalization and abstraction.4. FUNCTIONS OF THIS TOPIC: Third, let us help the students develop the 5 senses to thefull, to heighten their sensitivity to the world.Second, let us make use of the real things as instructionalmaterials for as long as we can.First, let us give our students opportunities top learn bydoing. Let us immerse our students in the world of experiences.5. How are you going to prepare in order to make an effective learning? Examples: preparing meals, making a project, doing power point...

Words: 645 - Pages: 3

Premium Essay

Finance Management

...Multiple choices: 1. Foreign exchange market in India is relatively very a. Big b. Small c. Medium d. None of the above 2. Balance of payment is a systematic record of all _______ during a given period of time. a. Political transactions b. Social transactions c. Economic transactions d. None of the above 3. Merchandise trade balance, services balance & balance on unilateral transfer are the part of ________ account a. Current account b. Capital account c. Official account d. None of the above 4. Interest rate swaps can be explained as an agreement between _________ parties a. One b. Two c. Three d. None of the above 5. Capital account convertibility in India evolved in August a. 1996 b. 1995 c. 1994 d. None of the above MM.100 1 IIBM Institute of Business Management Examination Paper: Finance Management 6. Interest rate parity is an economic concept, expressed as a basic algebraic identity that relates a. Capital rate & interest rate b. Interest rate & exchange rate c. Currency rate & exchange rate d. None of the above 7. The two kind of swap in the forward market are a. Forward & reverse swap b. Reverse swap & option swap c. Forward & option less swap d. Forward swap & option swap 8. FEMA stands for a. Forward exchange market b. Future exchange market c. Foreign exchange management act d. None of the above 9. Exchange rate quotation methods are a. Direct and direct b. Indirect and indirect c. Direct and indirect d. None of the above 10. International Fisher effect or generalized...

Words: 2328 - Pages: 10

Free Essay

Cs546: Quantitative Methods for Information Systems

...Name: PAULIN T. Assignment 1 1. Let[pic], where [pic] is the set of integers and[pic]. F(x) is a one-to-one function if we can show that: For [pic] and[pic], [pic]=[pic]===> [pic]=[pic] Let’s find out: [pic]==> [pic]=[pic], and [pic]=[pic] So, [pic]=[pic]==> [pic]=[pic]. Subtracting 101 on both sides gives [pic]==> [pic]=[pic]. Since we’re able to show that [pic]=[pic] ==> [pic]=[pic], we then conclude that [pic] is a one-to-one function. 2. Let’s prove that [pic] is a one-to-one function. To prove that, we have to show that For [pic] and[pic], [pic]=[pic]===> [pic]=[pic] So, [pic]==> [pic] and[pic]. [pic]=[pic]==> [pic]=[pic] Subtracting -3 on both sides gives [pic]=[pic] By simplifying 4, we easily have [pic]=[pic], hence the result!!! Since we proved that [pic]=[pic]===> [pic]=[pic], we easily conclude that [pic] is a one-to-one function. 3. The ceiling function maps every real number to the smallest integer greater than or equal to that number,[pic], where [pic] is the smallest integer greater than or equal to [pic]. a) Is the ceiling function a one-to-one function? Let’s find out: The ceiling function is a one-to-one function if and only if for [pic] and[pic], [pic]=[pic]===> [pic]=[pic] By considering these real numbers, [pic]=5.60 and [pic]=5.88, if we apply the ceiling function to both real numbers; we’ll have the following output: [pic]=6 and [pic]=6. We notice here that [pic]=[pic]=6, but[pic][pic][pic]. We see that using the...

Words: 1357 - Pages: 6

Premium Essay

Ssss

... E/D D Esus E AAbove all powers, a - bove all kingsA/C# E/D D Esus E AAbove all na - ture and all created thingsA/G# F#m Amaj7/E D A/C#Above all wisdom and all the ways of manBm7 D/A E/G# AYou were here before the world began A/C# E/D D Esus E AAbove all kingdoms, above all thrones A/C# E/D D Esus E AAbove all wonders the world has ever known A/G# F#m Amaj7/E D A/C#Above all wealth and treasures of the earthBm7 D/A C#sus/G# C#There’s no way to measure what You’re worth Chorus A Bm7 E/G# ACrucified, laid behind the stone Bm7 E/G# AYou lived to die, rejected and alone A/G# F#m Amaj7/E D A/C#Like a rose trampled on the ground Bm7 A/C# D2 EsusYou took the fall and thought of meE A D Esus E A D/A AAbove all Above All Writer/Composer : Paul Baloche Original Key : A | Current Key : D | | | Print Version : Small | Medium | Large | Intro D G Asus A D G/D Verse D A/G G Asus A DAbove all powers, a - bove all kingsD/F# A/G G Asus A DAbove all na - ture and all created thingsD/C# Bm Dmaj7/A G D/F#Above all wisdom and all...

Words: 36646 - Pages: 147

Premium Essay

Probability

...Prof. Dr. Somesh Kumar Department of Mathematics Indian Institute of Technology, Kharagpur Module No. #01 Lecture No. #07 Random Variables So, far we were discussing the laws of probability so, in the laws of the probability we have a random experiment, as a consequence of that we have a sample space, we consider a subset of the, we consider a class of subsets of the sample space which we call our event space or the events and then we define a probability function on that. Now, we consider various types of problems for example, calculating the probability of occurrence of a certain number in throwing of a die, probability of occurrence of certain card in a drain probability of various kinds of events. However, in most of the practical situations we may not be interested in the full physical description of the sample space or the events; rather we may be interested in certain numerical characteristic of the event, consider suppose I have ten instruments and they are operating for a certain amount of time, now after amount after working for a certain amount of time, we may like to know that, how many of them are actually working in a proper way and how many of them are not working properly. Now, if there are ten instruments, it may happen that seven of them are working properly and three of them are not working properly, at this stage we may not be interested in knowing the positions, suppose we are saying one instrument, two instruments and so, on tenth...

Words: 5830 - Pages: 24

Free Essay

Advanced Algorithms

...Vijay V. Vazirani College of Computing Georgia Institute of Technology Copyright c 2001 Approximation Algorithms Springer Berlin Heidelberg NewYork Barcelona Hong Kong London Milan Paris Singapore Tokyo To my parents Preface Although this may seem a paradox, all exact science is dominated by the idea of approximation. Bertrand Russell (1872–1970) Most natural optimization problems, including those arising in important application areas, are NP-hard. Therefore, under the widely believed conjecture that P = NP, their exact solution is prohibitively time consuming. Charting the landscape of approximability of these problems, via polynomial time algorithms, therefore becomes a compelling subject of scientific inquiry in computer science and mathematics. This book presents the theory of approximation algorithms as it stands today. It is reasonable to expect the picture to change with time. The book is divided into three parts. In Part I we cover a combinatorial algorithms for a number of important problems, using a wide variety of algorithm design techniques. The latter may give Part I a non-cohesive appearance. However, this is to be expected – nature is very rich, and we cannot expect a few tricks to help solve the diverse collection of NP-hard problems. Indeed, in this part, we have purposely refrained from tightly categorizing algorithmic techniques so as not to trivialize matters. Instead, we have attempted to capture, as accurately as possible, the individual character...

Words: 140657 - Pages: 563

Premium Essay

Mba Quesion Paper

...function of Business Organizations: a. Information b. Communication c. Power d. None of the above 2. Physiological Barriers of listening are: a. Hearing impairment b. Physical conditions c. Prejudices d. All of the above 3. Which presentation tend to make you speak more quickly than usual: a. Electronic b. Oral c. Both ‘a’ and ‘b’ d. None of the above 4. What is the main function of Business Communication: a. Sincerity b. Positive language c. Persuasion d. Ethical standard 5. The responsibilities of the office manager in a firm that produces electronics spares is: a. Everything in the office runs efficiently b. Furniture and other equipment in the office is adequate c. Processing all the incoming official mail and responding to some d. All of the above IIBM Institute of Business Management Examination Paper : Semester II 6. Labov’s Storytelling Model based on: a. Communication through speech b. Language learning c. Group Discussions d. None of the above 7. Diagonal Communication is basically the: a. Communication across boundaries b. Communication between the CEO and the managers c. Communication through body language d. Communication within a department 8. How to make Oral Communication Effective? a. By Clarity b. By Brevity c. By Right words d. All of the above Direct Eye contact of more than 10 seconds can create: a. Discomfort & Anxiety b. Emotional relationship between listeners and speakers c. Excitement d. None of the above 9. 10. Encoding means: a....

Words: 1041 - Pages: 5