Posts

Showing posts from November, 2024

Chapter : 4 Programming in C

Image
Rules for Naming a Variable in C: Can only contain letters (A-Z, a-z), digits (0-9), and underscores (_). ✅ student_age , num1 , total_marks ❌ student-age (hyphen not allowed) Must begin with a letter or an underscore (_), but not a digit. ✅ _temp , data1 ❌ 1number (cannot start with a digit) Cannot be a C keyword (reserved word). ❌ int , float , return (invalid because they are reserved words) Case-sensitive (uppercase and lowercase are different). Total , total , and TOTAL are three different variables. Should not contain spaces. ✅ studentMarks ❌ student marks (space is not allowed) 4.2 Functions 4.2.1 Concept of library and user defined functions and advantages Function:  A function in C is a self-contained block of statements that performs a specific task, and it can be called from another part of the program whenever needed.  It helps in modular programming, code reusability, and easy debugging . Functions are very im...