Identifiers are the fundamental building blocks of a program Used to give names

Identifiers are the fundamental building blocks of a

This preview shows page 10 - 20 out of 35 pages.

Identifiers are the fundamental building blocks of a program Used to give names to variables, functions, constant, and user defined data. They are user-defined names and consist of a sequence of letters and digits
Image of page 10
©LPU CSE101 C Programming Rules for naming an Identifier
Image of page 11
©LPU CSE101 C Programming Some Identifiers Tool_spanner; tool_spanner; FORMULA1; engine_1; both are different Wrong identifiers name 1_engine; break; @car-roof;
Image of page 12
©LPU CSE101 C Programming C Keywords Keywords are the reserved words whose meaning has already been explained to the C compiler. We cannot use these keywords as variables. Each keyword is meant to perform a specific function in a C program. There are 32 keywords in C language. All keywords are written in lowercase only Eg: The name of person can never be home , eat , sleep , run , etc because these words have some predefined meaning to perform some task. Quick yak: Ask students some of the keywords i.e. words which are by themselves and cannot be used for anything else ex: left, right…
Image of page 13
©LPU CSE101 C Programming List of C Keywords auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void default goto sizeof volatile do if static while
Image of page 14
©LPU CSE101 C Programming Data Types Data type means the type of value a variable will have. It also defines memory space for a particular variable in computer. The type of value of variable can be alphabets or numbers. The numbers can be further divided as the integer or rational number.
Image of page 15
©LPU CSE101 C Programming Lets see a mathematics problem:
Image of page 16
©LPU CSE101 C Programming My-Car 1. If the radius of car wheel is 15inch then what will the distance traveled after one rotation of that wheel? Sol: Given- radius = 15 dist_travelled = ? So, Circumference of circle = 2 * pi * r dist_travelled = 2 * 3.14 * radius dist_travelled = 6.28 * 15 dist_travelled = 94.2 Ans. 15 15 3.14 3.14 94.2 94.2 Integer( int in C ) Real ( float in C) Real ( float in C)
Image of page 17
©LPU CSE101 C Programming My-Grades 2. Five students have appeared for Mathematics exam and their respective marks are 84 , 34 , 97 , 58 , 64 consider the rank bands and their respective grades as 80 to 100 A 60 to 79 B 40 to 59 – C less than 40 – D So find the grade for each students?
Image of page 18
©LPU CSE101 C Programming Sol: Given- M1= 84 , G1=?
Image of page 19
Image of page 20

You've reached the end of your free preview.

Want to read all 35 pages?

  • Spring '18
  • Aman
  • Long integer, Short integer

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
A+ icon
Ask Expert Tutors