2 Pages

pointers

Course: ELECTRICAL ENEE150, Spring 2011
School: Maryland
Rating:
 
 
 
 
 

Word Count: 239

Document Preview

pointer A is a variable that stores the address of another variable =>Provides another way to re fu to a variable, through its address ratger tgab its symbolic name -Declaration int *p; Setting Pointers: int a, *p, *g; p = &a; // & means 'address of int', p is the address of a g = p; // g has the same address of p Access through Pointers: int a, x, y, *p; p = &a; x = *p + y; //...

Register Now

Unformatted Document Excerpt

Coursehero >> Maryland >> Maryland >> ELECTRICAL ENEE150

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
pointer A is a variable that stores the address of another variable =>Provides another way to re fu to a variable, through its address ratger tgab its symbolic name -Declaration int *p; Setting Pointers: int a, *p, *g; p = &a; // & means 'address of int', p is the address of a g = p; // g has the same address of p Access through Pointers: int a, x, y, *p; p = &a; x = *p + y; // pointer dereference *p = x + y; Memory ---------| | | | ---------0021303 | a ---------| | | | ---------0021323 | p ---------| | | | ---------- | // a is a variable; we make the address p to indicate the location of a; | // p is the location of a; but p also has a location 'int **p;' Printing Pointers: printf("%p", // p); print the thing stored in p III .pointer arithmetic Adding a value to a pointer changes the pointer in increments of the sign of the element being pointed to: (e.g.) Int a, *p; Double b, *g; P = &a; P = P + 5; If &a = 0x100, then p = 0x100 + (4*5) = 0x114 //4 is for int, 4 bites G = &b; G = g+3; If &b = 0x200, then p = 0x200 + (8 *3) = 0x218 //8 is for double, 8 bites P++; => 0x114 + 4 = 0x118 G++; => 0x218 +8 = 0x220 *(a+i) = &a[i] IV. Pointers and Function Arguments Int main() { Int x = 5; Foo(x); } Void foo (int z) { Int y; Y = z + 10; Z = 7; } Int main() { Int x = 5; Foo(&x); } Void foo (int *z) //int * is pointer declaration { Int y; Y =* z + 10; Z = 7; }
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Maryland - ELECTRICAL - ENEE150
I. Scriptsa. A script is a full-fledged piece of code, but instead of C, it uses Shell.b. Scripts are not compiled. They are interpreted.b.i. First line is always comment and always has to say what shell yourerunning. Ex. #!/bin/cshb.ii. Any unix scr
Maryland - ELECTRICAL - ENEE150
I. Pointersa. Pointers have to do with naming variables.b. They access variables not by symbolic names but location in memory.c. Location/address is a number. You can compute on it, thats why its powerful.You cant compute on a symbol. It allows you to
Maryland - ELECTRICAL - ENEE150
I. Multiple Modulesa. A module is a .c file.b. We can build the program in multiple .c files. This is another way of groupingthings.c. Group related functions in the same .c file.d. When compiling, list all .c files.d.i. Ex. gcc chess.c board.c chec
Maryland - ELECTRICAL - ENEE206
LABORATORY 10Thevenin Equivalent Circuits and Nonideal SourcesLab Goals1. Gain practical experience of working with simpleresistive circuits2. Construct and characterize a 4-bit D/A converter3. Characterize non-ideal voltage sources at variousfrequ
Maryland - ELECTRICAL - ENEE206
LABORATORY 14Monostable and Astable Circuits Lab Goals The main purpose of this lab is to introducemonostable and astable circuits. Another goal is to introduce the 555 timerchip, to understand how it works, and to learnabout a few of its uses, inc
Maryland - ELECTRICAL - ENEE206
LABORATORY 13 Rectifier Circuits Lab Goals In this lab you will learn about the operation ofdiodes, and characterize half-wave and fullwave rectifier circuits both with and withoutfiltering. You will also learn about Zener diodes anddesign, constru
Sewanee - BIO - 232
Biology 232Toxicology1Toxicology = Study of adverse affects of substances on human healtho How the body processes and reacts to poisonsToxins - derived naturally from plants and animals (e.g. ricin, strychnine, aflatoxin)Toxicants resulting from hum
Sewanee - BIO - 232
Biology 232Exposure & EpidemiologyFall 20101Exposure Assessment Goal is to quantify exposure (routes = ingestion, inhalation, dermal contact) Requires understanding of fate and transport and toxicology (effect in body)Exposure pathway - begins with
Sewanee - BIOLOGY - 311
Immunology Exam 1Chapter 1Innate immunity- molecular and cellular mechanisms pre-deployed before an infection andpoised to prevent or eliminate it; makes use of pattern recognitionAdaptive immunity- develops in response to infection and adapts to reco
Sewanee - BIO - 203
EVOLUTION1. Biological populations change through time = the pattern of evolution2. The causes of change: the mechanisms of evolution = the process of evolutionThe Pattern of Evolution-Biologists believe that: populations of organisms have changed thr
Sewanee - BIO - 203
Mechanisms of Evolution: Selection and DriftNatural SelectionNatural selection is one of the mechanisms by which evolutionary change can take place. Thismechanism was first proposed by Darwin and Wallace. Three conditions must be met for natural select
Sewanee - BIO - 203
SpeciationAny mechanism of evolution must account for three categories of observation:First, the observation that populations can change through time; second, the seeminggood fit between organisms and their environment; third, the incredible diversity
Washington State - ECON - 301
251x0312 9/23/03ECO251 QBA1 FIRST HOUR EXAM October 1, 2003 Name: _ Social Security Number: _Part I. 1.(32 points) The process of using sample statistics to draw conclusions about true population parameters is called a) statistical inference. b) the sc
Washington State - ECON - 301
251y0322 10/27/03ECO251 QBA1 SECOND HOUR EXAM March 21, 2003 Name: _KEY_ Social Security Number: _Part I: (48 points) Do all the following: All questions are 2 points each except as marked. Exam is normed on 50 points including take-home. Please re-read
Binghamton - ECON - 436
Economics 436 Fall 2011Last Years Midterm Exam III.Multiple Choice1. Which of the following is NOT a contributing factor in external economies of scale?a. Specialized suppliers are more likely to be kept in business when the industry growsb. Workers
Binghamton - ECON - 436
Economics 436: International TradeFall 2011Mingmei JonesPhone: 777-4755Email: mjones@binghamton.eduLT 914Office Hours: Mon., 1:30 2:30 p.m.Thur., 3:00-4:00 p.m.and by appointmentText: Krugman, Obstfeld and Melitz, International Economics: Theory
Binghamton - ECON - 436
Econ 436 Fall 2011M. JonesHomework Assignment 1Due Tuesday, September 6Note: Please TYPE up this assignment.Part I1. In this exercise you will produce a scatter plot similar to Figure 2.2 on P. 12 of the textbook,but with the most recent data avail
Binghamton - ECON - 436
Econ 436 Fall 2011M. JonesHomework 1 Answer KeyPart I.1.a.USexports to($ million)CountryAustriaBelgiumBulgariaCyprusCzech RepublicDenmarkEstoniaFinlandFranceGermanyGreeceHungaryIrelandItalyLatviaLithuaniaLuxembourgMaltaNetherla
Binghamton - ECON - 436
Econ 436 Fall 2011M. JonesHomework Assignment 2Due Tuesday, September 201. Do these problems on p. 48 of the textbook: 1, 2, 3, 4, 6.(If youre using the 8th edition, these problems on are p. 52.)2. It is usually claimed in trade textbooks that wages
Binghamton - ECON - 436
Econ 436 Fall 2011Prof. M. JonesInstructions for Trade in News and CommentsFind one or several news articles in the last 12 months on a story on international trade thatyou find interesting. You should only use reputable news sources.1. Write a parag
Binghamton - ECON - 436
Economics 436 Fall 2011Last Years Midterm II. Multiple Choices1. Today more than 50% of developing countries exports area. Agricultural goodsb. Mineral goodsc. Servicesd. Manufactured goods2. Which of the following countries share of trade with th
Binghamton - ECON - 436
Economics 436 Fall 2011Answer Key to Sample Midterm II.1.2.3.4.5.6.7.8.dacacdbbII.1.2.3.4.5.6.TTTFFTIII.1.a. The numbers in the last column are: 5, 1.5, 2/3, 4.b. Brazil will specialize in coffee and figs. Argentina will
Binghamton - ECON - 442
7/16/2011Chapter7OptimalRiskyPortfoliosChapter7OptimalRiskyPortfoliosCovariance- Part IPortfolios of Two Risky Assets / Markowitz Calculations- Part IIDiversification / Efficient Frontier- Part III17/16/2011CovarianceConsider 2 risky assets,
Binghamton - ECON - 442
7/16/2011Chapter7OptimalRiskyPortfoliosCovariance- Part IPortfolios of Two Risky Assets / Markowitz Calculations- Part IIDiversification / Efficient Frontier- Part IIITwoRiskyAssetsRecall the equation we derived in Chapter 6:2 C p s wA rA s wB
Binghamton - ECON - 442
7/16/2011Chapter7OptimalRiskyPortfoliosCovariance / Portfolios of Two Risky Assets- Part IMarkowitz Calculations- Part IIDiversification / Efficient Frontier- Part III2RiskyAssets+RiskFreeAssetE r CAL P CAL E EPCAL DE Mix CAL D DErfD1
Binghamton - ECON - 442
7/16/2011Chapter8IndexModelsPages246 256+269Observation12Return on M.04Return on i.05ri3456.06.08.10.12.140.10.20.15.22ri242422222020181816161414121210108866442200246810121416rM002468101
Binghamton - ECON - 442
7/24/2011Chapter9 Part1TheCapitalAssetPricingModelMonday: CAPMTheoryandInterpretation ReadChapter&startproblemsTuesday: Moregraphicalanalysis,Examples WorkonproblemsWednesday: MoreExcel WorkonspreadsheetThe CAPMThe CAPM is a model!Assumptions (pag
Binghamton - ECON - 442
7/25/2011Chapter9 Part2TheCapitalAssetPricingModelMonday: CAPMTheoryandInterpretation ReadChapter&startproblemsTuesday: Moregraphicalanalysis,Examples WorkonproblemsWednesday: MoreExcel WorkonspreadsheetTheCAPM EquationE ri rf i E rM rf 9.9What
Binghamton - ECON - 442
7/27/2011Chapter10TheArbitragePricingTheoryandMultifactorModelsofRiskandReturnThursday: APT ReadChapter10&startproblemsFriday: FinishChapter10problems&ExcelassignmentMonday: Chapter11 TheEfficientMarketHypothesisTheArbitragePricingTheoryAPT Develo
Binghamton - ECON - 442
7/31/2011Chapter11TheEfficientMarketHypothesisTuesday: Chapter20 OptionsMarkets:Introduction(Definitions&Strategies)Thursday: Chapter21 OptionValuation(Binomial&BlackSholes)TheEfficientMarketHypothesisMaurice Kendall [1953]Random Walk vs. Submartin
Binghamton - ECON - 442
8/1/2011Chapter 20 (Part 1)20 (Part 1)Options Markets: IntroductionWednesday: Chapter 20 (Part 2) Option Strategies / ExamplesThursday: Work on Chapter 20 problemsWork on Chapter 20 problemsFriday: Chapter 21 (Part 1) Option Valuation (Binomial & B
Binghamton - ECON - 442
8/2/2011Chapter 20 (Part 2)20 (Part 2)Options Markets: IntroductionThursday: Work on Chapter 20 problemsFriday: Chapter 21 (Part 1) Option Valuation (Binomial & Black-Sholes)21 (Part 1) Option Valuation (Binomial BlackYesterday0|S0T|ST = ?t
Binghamton - ECON - 442
8/4/2011Chapter 21 (Part 1)21 (Part 1)Option ValuationToday: Chapter 21 (Part 1) Restrictions on Option Values, Binomial Option PricingMonday: Chapter 21 (Part 2) More Binomial, Black-Scholes21 (Part 2)More Binomial, BlackRestrictions on Option Va
Binghamton - ECON - 442
8/7/2011Chapter 21 (Part 2)21 (Part 2)Option ValuationToday: Chapter 21 (Part 2) Binomial Option Pricing, Synthetics, Portfolio InsuranceTuesday: Chapter 21 (Part 3) Black-ScholesBinomial Model ReviewPricing a 1-binomial period call option.(1) Sol
Binghamton - ECON - 442
8/8/2011Chapter 21 (Part 3)21 (Part 3)Option ValuationToday: Chapter 21 (Part 3) Black ScholesWednesday: Chapter 22 Futures MarketsOptions and Risk - 1Stock Process1201201001 009090Bond Process1 103010027.2711030Call Option(X = 110,
Binghamton - ECON - 442
8/9/2011Chapter 2222Futures MarketsToday: Chapter 22 Forwards and FuturesThursday: Study DayOnline Office HoursWednesday: 4:30 4:30 pm EST, 7:00 7:45 pm ESTThursday: 10:00 11:00 pm ESTFutures MarketsThe futures contract calls for delivery of a c
Binghamton - ECON - 442
The Chapter 20 Connect assignment has a number of egregious errors and I apologize forthat. Please find below answers to 3 problems from the back of Chapter 20.Note that there is a typo in question 11, the call and put exercise prices should bereversed
Binghamton - ECON - 442
Econ 442 Financial EconomicsSummer 2011Final Exam Information(1) Date: Friday, August 12, 2011(2) Duration: The exam is 1 hour in length.(3) Time: You must start the exam between 12:00 pm and 1:00 pm.(4) Format: The final exam will consist of 5 essa
Binghamton - ECON - 442
1/2I. Population ParametersScenarioReturnProbability10.020.0520.030.1030.040.2040.050.3050.060.2060.070.1070.080.05Distribution of Returns0.350.30P rob ab ility0.250.200.150.100.050.000.020.030.040.050.060.070.08
Binghamton - ECON - 442
7/12/2011Chapter5IntroductiontoRisk,Return,andtheHistoricalRecordHoldingPeriodReturnsHPR Ending price of a share Beginning price Cash dividendBeginning price$100HPR (5.10)$120120 100 0 20 0.20 20%10010017/12/2011HoldingPeriodReturnsHPR
Binghamton - ECON - 442
7/13/2011Chapter6RiskAversionandCapitalAllocationtoRiskyAssetsChapter6RiskAversionandCapitalAllocationtoRiskyAssetsRisk Aversion- Part ICombining a Risk-free Asset with a Risky Asset- Part II17/13/2011Chapter6RiskAversionandCapitalAllocationto
Binghamton - ECON - 442
7/13/2011Chapter6RiskAversionandCapitalAllocationtoRiskyAssetsMaximizingExpectedUtilityGraphically,tomaximizeutilityaninvestorwanttomovetotheindifferencecurvethefarthesttotheNWaspossible.Thatis,attainthehighestlevelofutility.E17/13/2011RiskyandRi
Binghamton - ECON - 442
PREFERENCE & UTILITY THEORYx y means that the consumer thinks that x is at least as good as y, "weak preference"x y "strict preference"x y "indifference"The individual has a preference ordering on X, which is a complete ordering (A1 A3).A1. Complete.
Binghamton - ECON - 442
ECON 442: Financial economicsSyllabus Summer 2011Graham Lemke, Ph.D.E-mail: gklemke@binghamton.eduCourse Description:This course is an introduction to the economic theory of investment. Models of risk and return aredeveloped to provide a basis for a
Binghamton - ECON - 442
Tuesday, July 22, 20XXMarkets Cheer What Fed Leaves OutIn the market, the Fed left its target short-term rate unchanged, but many investing professionalsthought the bank left the door open to a potential cut in the months ahead. The Dow rose 159.42poi
Binghamton - ECON - 466
Economics 466: Introductory EconometricsState University of New York at BinghamtonDepartment of EconomicsFall 2011Midterm IThe exam consists of three questions on three pages. Each question is of equal value.1. Consider the residuals obtained via an
Binghamton - ECON - 466
Economics 466: Introductory EconometricsState University of New York at BinghamtonDepartment of EconomicsFall 2011Midterm I Answers1. (a)(b)nXi=1nXi=1nXi=1bvi =bbbyi xi =nXi=1yi (y x) xi = ny ny + nx nx = 0bbbbnnnXXXbb[
Binghamton - ECON - 466
Economics 466: Introductory EconometricsState University of New York at BinghamtonDepartment of EconomicsFall 2011Midterm IIThe exam consists of three questions on three pages. Each question is of equal value.1. Consider the F -statistic discussed i
Binghamton - ECON - 466
Economics 466: Introductory EconometricsState University of New York at BinghamtonDepartment of EconomicsFall 2011Midterm II Answers221. (a) Ru is the R2 from the unrestricted model, Rr is the R2 from the restricted model (the model thatimposes th
Binghamton - ECON - 467
Economics 467: Economic ForecastingState University of New York at BinghamtonDepartment of EconomicsSpring 2010Midterm IIThe exam consists of three questions on two pages. Each question is of equal value.21. Consider the model yt = c + yt1 + t + t1
Binghamton - ECON - 467
Economics 467: Economic ForecastingState University of New York at BinghamtonDepartment of EconomicsSpring 2010Midterm I Answers1. (a) Stationary(b) Stationary(c) Stationary(d) Stationary(e) Stationary(f) Stationary(g) Stationary(h) Nonstation
Binghamton - ECON - 467
Economics 467: Economic ForecastingState University of New York at BinghamtonDepartment of EconomicsSpring 2010Midterm IThe exam consists of three questions on two pages. Each question is of equal value.1. State (do not explain) whether or not the f
Binghamton - ECON - 467
Economics 467: Economic ForecastingState University of New York at BinghamtonDepartment of EconomicsSpring 2010Midterm II Answers1. (a) ln L () = T ln 2 2T2ln 2 12 2TXt=1(b) In OLS we want to minimize SSR =(yt c yt1 t1 )2TXt=1want to m
Binghamton - ECON - 467
Economics 467: Economic ForecastingDepartment of EconomicsState University of New York at BinghamtonProblem Set #1 Answers (Linear Regression)1. (a) Neither gure appears to have a constant mean or variance.(b) They appear to move together. In general
Binghamton - ECON - 467
Economics 467: Economic ForecastingDepartment of EconomicsState University of New York at BinghamtonProblem Set #1 (Linear Regression)1. The le entitled MONEYDEM.XLS contains quarterly values of seasonally adjustedU.S.3-month (T B 3mo) and 1-year (T
Binghamton - ENG - 300M
English 300M-Spring 2011Children's LiteratureMonday/Wednesday 1:10-2:10UU 120Prof. SignorottiOffice: College in the Woods 1EHours: Monday/Wednesday 10:30-11:30Email: esignorotti@binghamton.eduFairy tales are more than true: not because they tell u
Binghamton - ENG - 300M
Useful tips for critical prose.Thesis statements: be precise. A topic is usually one word: shoes, hair, age, beauty, wealth. A thesisstatement proposes an argument about the topic: the quality of shoes demonstrates social worth; older,married women gai
Binghamton - HIST - 104A
Everything after MidtermPart 1: IDs/given 6 sanswre 4 (32 points)Part 2: essay group 1 (34 points)Part 3: essay group 2 (34 points)Keyword: WatergateConservatism TriumphantPolitical and Economic Crisis of 1970s Oil embargo and recession stagflatio
Binghamton - HIST - 104A
HIST 104 Quiz 1: Worker in the Industrial Era (chapter 2 of Thinking Through the Past)Name:_Section:_Instructions: Answer the following questions in short answer format. The entire quizshould be no more than two pages in length. Print out your respons
Binghamton - HIST - 104A
Key termsPhil-Am WarOpen Door NotesHomestead StrikeCoxeys Army1896 electionMachine politicsVertical integrationHorizontal integrationDawes ActHomestead ActMississippi state constitutionPlessy v FergusonKnights of LaborAmerican Federation of
Binghamton - HIST - 104A
Keywords for final:1. Watergate (1972) The scheme to conceal links between the White House and theaccused Watergate burglars had succeeded2. Election of 19683. Gulf of Tonkin Resolution4. Tet Offensive5. War on Poverty6. Immigration Act of 19657.