Posts

4.3 Enumeration

Image
Enumeration types (enum): - Enumeration is a user defined data type that assigns names (strings) to integer constant values. We can write strings in the form of integers. Every string starts from 0 to (n-1) integer constant values by default. If we provide a value for a string the increment starts from the value by 1. Enum is a keyword used for enumeration. It makes code more readable and maintainable by letting you use descriptive names instead of raw integers.                          Example: - Output: -

4.2 Structures & Unions in C

Image
  v User defined data types Ø The data types which are created by the user with the help of basic data types are known as user defined data types. Ø   It uses Basic or predefined or Primary data types are int , char , float , double , void. Ø   C allows us to create or define our own data types. This is done for the purpose of customized programming and to reduce the complexity of programs. Ø   In C, user defined data types can be created in three different ways. 1.       Structures 2.       Unions 3.       Enumerations   1)     Structures: - Ø A structure in C is a user-defined data type that allows us to combine variables of different data types under a single name. Ø Structures help organize complex data like student or employee details Ø The struct keyword is used to define a structure. Ø It represents a record (e.g., student name, roll n...

4.1 Pointers

Image
Pointers: - A pointer is a special variable that stores the memory address of another variable. Instead of holding a direct value (like 10 or 3.5), a pointer holds the location where the value is stored in memory. Pointers are powerful in C programming because they allow direct access to memory, dynamic memory allocation, and efficient data manipulation. Every variable in C is stored at a specific memory location, identified by a unique address. The address-of operator (&) is used to get the address of a variable. %p format specifier is used to print an address in pointer format.   Declaring Pointer Variables: - A pointer variable is declared using an asterisk (*) before the variable name. The data type of the pointer must match the data type of the variable it points to. Initialization of Pointer Variables: - A pointer should always be initialized before using it. We can initialize a pointer by assigning it the address of a variable using the address-of o...

4.6 Data Communication

Image
  v   Data Communication: - Ø   Data Communication refers to the exchange of data between two or more devices through a transmission medium such as wired cables or wireless signals. Ø   It is the foundation of computer networks and the Internet. Ø   Key Elements of Data Communication ·         Sender (Transmitter): The device that sends the data (e.g., computer, smartphone). ·         Receiver: The device that receives the data (e.g., server, printer). ·         Message (Data): The information to be communicated (text, audio, video, etc.). ·         Transmission Medium: The physical path or channel for data transfer (cables, radio waves). ·         Protocol: A set of rules that governs data transmission (e.g., TCP/IP, HTTP). Types of Data Communication.   Ø ...