3156-22 - COMS W3156 Software Engineering Fall 2001...

Info icon This preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
COMS W3156: Software Engineering, Fall 2001 Lecture #22: C, C++, OS, etc… Janak J Parekh [email protected]
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Administrativia Prototype is in: enough for integration Our work never finishes: now working on reference model If problems with the prototype, come see us early Final exam: any questions? Open book doesn’t mean easier… Reminder: Research Fair this Friday http://acm.cs.columbia.edu/research Intro to Java Server pages and Servlets tomorrow See CS front doors…
Image of page 2
Next class Finish everything Monday will be MMM and final exam review Can you believe the semester has less than two weeks left?
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Today’s class A little bit more on C C++ Begin operating systems Begin design patterns, if time
Image of page 4
Struct Basically, a class without methods struct Point { int x; int y; }; /* note the semicolon */ int main(void) { struct Point myPoint; myPoint.x = 5; myPoint.y = 5; }
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Miscellany on structs (*myP).x looks ugly C has a bizarre shortcut: myP -> x Yes, a dash followed by a greater than Always remember that a -> b is equivalent to (*a).b Precedence of operators It’s cumbersome to have to say struct Point every time Use typedefs: define “aliases” typedef struct Point PointT; or even typedef struct Point *PointP;
Image of page 6
More miscellany on structs Since not everything happens in main, malloc’ing structs is very common The sizeof operator works on pretty much any datatype, be it structs or primitive datatypes Guaranteed tip: you will come across PointP myP = (PointP)malloc(sizeof(Poin tP)); and be glad that you were attending this class…
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Function prototypes As I said, C’s compiler is not all that smart If you have: int main(void) { int i = foo(); } int foo(void) { return 5; } It will not work
Image of page 8
Function prototypes (II) Need to clue in the compiler by putting the following prototype before main: int foo(void); Looks like a Java interface construct Often, you collect the prototypes into a header (.h) file, then #include it into your various source (.c) files
Image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
On various .c files… A common way to build multi-source-file code in C is to build a set of .h files that export functionality (i.e.
Image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern