How Sizeof(char) behave differently in C & C++
Duration: 8 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- About Course: About the Course
- English Language: Vocabulary, Noun, Adjectives, Tenses, Pronoun, Adverb, Preposition, Conjunction, Active Passive Voice (Voice), Articles, Direct and Indirect Speech, Sentence Correction (Error Correction), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Sentence Completion (Fill in the blanks), Cloze Test (Cloze Passage)
- Quantitative Aptitude & Numerical Ability: Ratio and Proportion (Ratios), Data Interpretation, Mixture and Alligation, Permutation and Combination, Number System, Sequence and Series (Series), Speed Time and Distance, Algebra, Speed Mathematics and Basic Mathematics, Percentage, Average, Time and Work, Simple Interest and Compound Interest, Profit and Loss, Age Problems, Partnership, Mensuration and Geometry, Probability, IBPS Specific Videos
- Reasoning: Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Puzzle Solving (Puzzles), Seating Arrangements, Blood Relations, Syllogisms, Inequality, Directions (Direction Test), Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Clock, Calendar, Analytical Reasoning (Counting Figures Reasoning), Selection Decision Table (Decision Making), Cubes & Dices, Machine Input-Output
- Data Structures- Professional Knowledge: Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
- Algorithms- Professional Knowledge: Algorithm Analysis, Time Complexity Analysis, Sorting Algorithms, Greedy Algorithms, Dynamic Programming, Minimum Spanning Trees, Shortest Path Algos
- Python- Professional Knowledge: Python for Placements by Yash Sir, Collections & Strings, Functions & Modules, File Handling & Data Analysis, Python Basics
- Operating System- Professional Knowledge: Introduction to OS, Process Management, Process Synchronization, CPU Scheduling, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Disc Scheduling, File Management, Unix OS, Linux OS, Windows OS
- DBMS + SQL- Professional Knowledge: Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), File Organization & Indexing, SQL, Transaction Management, Concurrency Control, Relational Algebra, Relational Calculus, NoSQL, Data Warehousing & Mining
- Computer Networks- Professional Knowledge: Introduction to CN, Data Communication, Net Layer: IP Addressing, Net Layer: IPv4 & Proto, Application Layer, Hardware basics, Network Security, Transport Layer Services, DLL: Flow Control, Cloud Computing
- Software Engineering- Professional Knowledge: Fundamentals of Software Engineering, Software Requirements and Quality Assurance, Software Design, Estimation and Metrics, Software Testing, Software Maintenance and Configuration Management
- Computer Organization & Microprocessor- Professional Knowledge: Basics of COA, Cache Memory Organization, Programming the Basic Computer, Instr Formats & Modes
- Digital Logic Design- Professional Knowledge: Digital Systems & Boolean Basics, Logic Gates & Hardware, Boolean Expression, Boolean Minimization, Combinational Circuit, Sequential Circuits, Number System, Number Representation
- Theory of Computation- Professional Knowledge: Introduction to TOC, Deterministic FA (DFA), Non-Deterministic FA, Regular Expressions, Regular Language Properties, Pushdown Automata & CFG, Turing Machines
- Compiler Design- Professional Knowledge: Intro to Compilers, Lexical Analysis, Grammar & CFG, Syntax Analysis: Top-Down, Intermediate Code Gen, Code Optimization
- Programming Languages- Professional Knowledge: C Programming by Yash Sir, Language Design, DMA, Macros, Scoping & File Handling, Object Oriented Programming (OOPS), Programming in C++, Java, HTML, C Language Core
- Emerging Tech- Professional Knowledge: Emerging Tech Trends, MS Office Applications
- Artificial Intelligence: Artificial Intelligence
- Image Processing: Digital Image Fundamentals
- Internet & Web Technology: Website, Browser & Services, Internet Fundamentals, Server Side & Security, Cyber Threats and Malware Attacks, Role of Internet and Web Services, Security in Mobile and Wireless Computing, Electronic Data Interchange and E-Commerce, Physical Security and Cryptography Basics, Cyber Safety and Security, Ethical Hacking
- Descriptive Paper: English Writing Ability
- Mains - Unit Tests:
- Mains - Full Mock Tests:
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This educational video is a lecture on the C and C++ programming languages, focusing on the `sizeof` operator. The instructor begins by introducing the topic with a slide comparing C and C++ and then transitions to a detailed explanation of the `sizeof` operator. The core of the lecture involves a side-by-side comparison of C and C++ code examples, demonstrating how to use `sizeof` to determine the size of data types like `char` and character literals. The instructor uses an online IDE, OnlineGDB, to run the code and show the output, which is 1 for a `char` and 1 for the character literal 'x'. The lecture concludes with a detailed analysis of the ASCII value of 'x' (65) and the size of the `char` data type, which is 1 byte, reinforcing the concept that the size of a `char` is always 1 byte in C and C++. The video is structured as a clear, step-by-step tutorial for students learning programming fundamentals.
Chapters
0:00 – 2:00 00:00-02:00
The video opens with a presentation slide titled 'C++ PROGRAMMING' with a background of C++ code. The instructor, Yash Jain, is visible in a small window in the bottom right corner. The slide transitions to a new one that compares C and C++ with a 'VS' graphic. The main topic is introduced as the 'sizeof operator', which is displayed on a computer monitor graphic. The instructor begins to explain the concept, setting the stage for a detailed discussion on the `sizeof` operator in C and C++.
2:00 – 5:00 02:00-05:00
The instructor displays two code snippets side-by-side: one in C and one in C++. The C code uses `#include <stdio.h>` and `printf`, while the C++ code uses `#include <iostream>` and `cout`. Both snippets contain the `sizeof` operator to find the size of a character literal 'x' and the `char` data type. The instructor then switches to the OnlineGDB IDE, where he runs the C code. The output shows that the size of 'x' is 1 and the size of `char` is 1. He then runs the C++ code, which also outputs 1 for both `sizeof('x')` and `sizeof(char)`, demonstrating that the size is consistent across both languages for these types.
5:00 – 7:34 05:00-07:34
The instructor returns to the presentation slide with the C and C++ code. He uses a yellow highlighter to annotate the code, writing '65' next to the character 'x' to represent its ASCII value. He then writes '1 byte' next to the `char` data type, explaining that the size of a `char` is always 1 byte. He circles the number 1 in the output, reinforcing that the size of a character literal and the `char` data type is 1 byte. The video concludes with a final summary of the key takeaway: the `sizeof` operator returns the size of a data type or value in bytes, and for a `char`, this is always 1 byte.
The video provides a clear and structured lesson on the `sizeof` operator in C and C++. It begins with a conceptual introduction, then moves to a practical demonstration using an online IDE to show the output of the operator for character types. The instructor effectively uses visual annotations to explain the relationship between the ASCII value of a character and its size in memory, reinforcing the fundamental concept that a `char` occupies 1 byte. The progression from theory to code execution and then to a detailed analysis ensures a comprehensive understanding of the topic for the student.

