Practical on Sizeof, Ternery and address of operators in C [Practical 8/ Lecture25]

Опубликовано: 21 Июль 2026
на канале: Master C Programming with M. Z. Rub
77
2

Welcome to Practical 8 of Lecture 25! In this hands-on session, we dive into the fundamental operators in the C programming language. We explore the sizeof, ternary, and address-of operators and demonstrate their practical usage.

The program begins by declaring variables of different data types: an int named x, a double named y, and a char named z. We then proceed to showcase the sizeof operator, which allows us to determine the sizes of these data types in bytes. The program will print the sizes of int, double, and char using the %lu format specifier.

Next, we introduce the ternary operator, which provides a concise way to make decisions based on a condition. Using an example, we demonstrate how to utilize the ternary operator on the condition's outcome. You'll witness the program printing the resulting value, giving you a clear understanding of the ternary operator's functionality.

Furthermore, we cover the address-of operator, denoted by the ampersand symbol. This operator allows us to obtain the memory addresses of variables. By applying the address-of operator to our variables x, y, and z, we showcase how to access and print their respective memory addresses using the %p format specifier.

By engaging with this practical session, you'll gain hands-on experience with these crucial C operators and strengthen your understanding of their applications. Join us as we explore the Sizeof, Ternary, and Address-of Operators in C!

Prerequisites: Basic knowledge of C programming, familiarity with variables and data types.

Timestamps:
0:00 - Introduction
0:30 - Declaring variables
1:05 - Using the sizeof operator
2:15 - Exploring the ternary operator
3:30 - Understanding the address-of operator
4:45 - Printing memory addresses
5:20 - Conclusion

Stay tuned for more informative lectures and practical sessions on C programming. Don't forget to subscribe to our channel for updates and more exciting content. Happy coding!