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
- Language Skills (English): Vocabulary Verbal Analogy (Word Based Analogy) Noun Pronoun Verb Adjectives Adverb Preposition Articles Conjunction Tenses Modals Subject Verb Agreement (Verb Noun Agreement) Determiner Active Passive Voice (Voice) Direct and Indirect Speech Sentence Correction (Error Correction) Sentence Completion (Fill in the blanks) Sentence Construction Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing) Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions) Cloze Test (Cloze Passage)
- General Aptitude (Quantitative Ability): Percentage Ratio and Proportion (Ratios) Average Profit and Loss Simple Interest and Compound Interest Time and Work Pipe and Cistern Speed Time and Distance Mixture and Alligation Age Problems Partnership Number System HCF LCM Divisibility Rules Powers and Exponents (Surds and Indices) Algebra Data Interpretation Statistics Sequence and Series (Series) Logarithm Arithmetic
- General Aptitude (Reasoning Ability): Series (Number and Letter Series) (Numerical Relations and Reasoning) Coding Decoding Syllogisms Blood Relations Directions (Direction Test) Ranking, Order and Sequence Inequality Logical Sequence Of Words Seating Arrangements Puzzle Solving (Puzzles) Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning) Cubes & Dices Venn Diagram Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning) Selection Decision Table (Decision Making) Analytical Reasoning (Counting Figures Reasoning) Clock Calendar Data Sufficiency Analogy
- Technical Skills MCQ - Data Structure: Introduction to DS Array Stack Queue Linked List Tree Graphs Hashing
- Technical Skills MCQ - Networking: Introduction to CN Data Communication DLL: Access Control DLL: Flow Control DLL: Error Control DLL: Framing Data Link Layer - Ethernet Net Layer: IPv4 & Proto Net Layer: IP Addressing Net Layer:Routing Protocol Transport Layer Services Application Layer Network Security
- Technical Skills MCQ - Operating System: Introduction to OS Process Management CPU Scheduling Process Synchronization Deadlock Threads & Process Creation Memory Management Virtual Memory File Management Windows OS Linux OS Security Virtual Machines
- Technical Skills MCQ - DBMS: Basics of DBMS ER Diagram Relational Model & Functional Dependencies Keys & Integrity Constraints Normalization (1NF - BCNF) File Organization & Indexing Relational Algebra SQL Transaction Management Concurrency Control Database Recovery Database Security & Authorization NoSQL
- Technical Skills MCQ - Software Engineering: Fundamentals of Software Engineering Software Requirements and Quality Assurance Software Design, Estimation and Metrics Software Testing Software Maintenance and Configuration Management
- Technical Skills MCQ - Cloud Computing: Cloud Computing and IoT
- Technical Skills MCQ - Cyber Security: Cyber and Info Security Security in Mobile and Wireless Computing
- Technical Skills (Coding): Coding Questions by Yash Sir C Programming by Yash Sir Programming in C++ Java Python for Placements by Yash Sir Object Oriented Programming (OOPS) DSA by Prashant sir Coding Questions Bank
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.

