slide02 - ICS 103 Computer Programming in C Handout-2 Topic Overview of C Objective To know about C Language Elements To know about general format and

slide02 - ICS 103 Computer Programming in C Handout-2 Topic...

This preview shows page 1 - 2 out of 3 pages.

ICS 103: Computer Programming in C Handout-2 Topic : Overview of C. Objective: To know about C Language Elements. To know about general format and syntax of simple C program. To know about variable declaration / identifiers and reserved key words in C. C LANGUAGE ELEMENTS: Preprocessor Directives: #include Directive for Defining identifiers from Standard Libraries : Syntax : #include<standard header file > e.g #include <stdio.h> #include<math.h> #define Directive for creating constant : Syntax : # define NAME value e.g #define PI 3.141593 #define MILES_PER_KM 0.62137 #define MAX_LENGTH 100 From this each identifier NAME is replaced by the constant value and this value will be remaining fixed (constant) throughout the whole program. Example: C program to find addition of two numbers is: /* To find sum of two numbers */ # include <stdio.h> // preprocessor directive int main (void) // main function { int number1, number2, sum; // variable declarations printf ("Please input two numbers : "); // to display message scanf ("%d %d",&number1, &number2); // to read 2 numbers
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read all 3 pages?

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

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes