CSC180H1 Lecture Notes - Lecture 16: Fibonacci Number, Scanf Format String, Lanthanum Hexaboride
Document Summary
Answer to our last in-class exercise (fibonacci-iterative), at the bottom of this file, prior to the exercises: we know the output facility (with respect to the user) is "printf". > usage: int i; printf("enter a number: "); scanf("%d",&i); > what does &i mean: introducing pointers. Idea: when we tell c "int i;" that means we are asking c to reserve some space in memory, large enough to hold an integer type. When we use "i" in our code, that refers to the data stored at that place in memory. That is, what is the address of that data --- the address meaning, as it does linguistically, the location of the data. C gives you access to that location: &i. There is an inverse operator to "&", and that is "*". So if i do: printf("%d",i); that is the same as me doing: printf("%d",*(&i)); Specifically: *(&i) means: the data at the address of i.