How Void Pointer behave differently in C & C++
Duration: 10 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- Communication Round: Vocabulary, Subject Verb Agreement (Verb Noun Agreement), Tenses, Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Cloze Test (Cloze Passage), Sentence Correction (Error Correction), Sentence Completion (Fill in the blanks), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Direct and Indirect Speech, Active Passive Voice (Voice), Verbal Analogy (Word Based Analogy), Articles, Preposition, Conjunction, Sentence Construction, English Writing Ability, Communication Assessment
- Quantitative Aptitude: Ratio and Proportion (Ratios), Divisibility Rules, Data Interpretation, Mixture and Alligation, Permutation and Combination, Logarithm, Number System, HCF LCM, Speed Time and Distance, Percentage, Average, Powers and Exponents (Surds and Indices), Time and Work, Mensuration and Geometry, Age Problems, Pipe and Cistern, Probability, Profit and Loss, Simple Interest and Compound Interest, Algebra
- Analytical and Logical Reasoning: Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Directions (Direction Test), Ranking, Order and Sequence, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Selection Decision Table (Decision Making), Logical Sequence Of Words, Puzzle Solving (Puzzles), Syllogisms, Seating Arrangements, Calendar, Clock, Blood Relations, Cubes & Dices, Venn Diagram, Analytical Reasoning (Counting Figures Reasoning)
- Cognizant Gaming Aptitude: Gamified / Game Based Aptitude
- Java (Cluster 1): Java
- ANSI SQL MySQL (Cluster 1,2,3): SQL
- HTML, CSS, JavaScript (Cluster 1,3): HTML, CSS, JavaScript
- Python (Cluster 2): Python for Placements by Yash Sir
- Cloud Fundamentals (Cluster 2): Emerging Tech Trends
- C# (Cluster 3): C#
- OOPs: Object Oriented Programming (OOPS)
- Technical Assessment (Coding): Coding Questions by Yash Sir, C Programming by Yash Sir, Programming in C++, Pseudo Codes
- Data Structures: Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
- DBMS: Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, File Organization & Indexing, Relational Algebra, Relational Calculus, Transaction Management, Concurrency Control, Database Recovery, ORDBMS, Database Security & Authorization, Query Processing & Optimization, Enhanced Data Models, Data Warehousing & Mining, Big Data Systems, NoSQL
- Operating Systems: Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Disc Scheduling, File Management, Windows OS, Linux OS, Security, Distributed Systems, Virtual Machines
- Computer Networks: 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, TL: Congestion & UDP, Application Layer, Hardware basics, Network Security, Mobile Technology, Cloud Computing and IoT, Cyber and Info Security
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This educational video, presented by Yash Jain from Knowledge Gate Eduventures, is a comprehensive tutorial on the application of void pointers in C and C++. The lecture begins with an introduction to the topic, using a title slide that displays the C and C++ logos and the text 'Application of Void pointer'. The instructor then transitions to a code-based explanation, presenting two code snippets side-by-side: one in C and one in C++. The core of the lesson focuses on the incompatibility between `void *` and `char *` pointers. The instructor demonstrates that in C++, a direct assignment like `char *ptr2 = ptr1;` where `ptr1` is a `void *` pointer will result in a compilation error due to the strict type checking. This is contrasted with C, where such a conversion is allowed implicitly. The video provides a practical demonstration using an online C++ compiler, showing the exact error message: 'error: invalid conversion from 'void*' to 'char*' [-fpermissive]'. To resolve this, the instructor shows the correct method: explicit type casting, writing `ptr2 = (char*)ptr1;`. The video concludes with a 'Thanks' slide, providing contact information for the course provider.
Chapters
0:00 – 2:00 00:00-02:00
The video opens with a title slide for a programming lecture. The slide features a dark background with green and white C++ code floating around. The main title is 'C++ PROGRAMMING' in large white letters, with 'By YASH JAIN' in the top right corner. The slide also includes a graphic of a computer monitor with the C and C++ logos and the text 'Application of Void pointer'. The instructor, Yash Jain, is visible in a small window in the bottom right corner. The slide also contains a copyright notice for 'KNOWLEDGE GATE EDUVENTURES' and a call to action to download the KG app or visit their website.
2:00 – 5:00 02:00-05:00
The video transitions to a code demonstration. The screen is split into two sections, each showing a C++ code snippet. The left snippet is labeled 'C' and the right is labeled 'C++'. Both snippets contain the same code: `#include <stdio.h>`, `int main()`, `{`, `void *ptr1;`, `char *ptr2;`, `ptr2 = ptr1;`, `return 0;`, `}`. The instructor explains that in C++, this code will not compile due to a type mismatch. He then writes on the screen, adding `char *ptr;` and `int *ptr;` to illustrate the concept of type casting. The instructor's voiceover explains that a `void *` pointer can point to any data type, but it cannot be directly assigned to a pointer of a specific type like `char *` without an explicit cast.
5:00 – 9:45 05:00-09:45
The instructor continues the demonstration, focusing on the C++ code snippet. He highlights the line `ptr2 = ptr1;` and explains that this is an invalid conversion. He then shows the correct way to perform the conversion by adding an explicit cast: `ptr2 = (char*)ptr1;`. The video then cuts to a screen recording of an online C++ compiler, where the instructor types the code and runs it, showing the compilation error: 'error: invalid conversion from 'void*' to 'char*' [-fpermissive]'. He then adds the cast, and the code compiles successfully. The video ends with a 'Thanks' slide, providing contact information for the course provider, including a Telegram group and an email address.
The video provides a clear and practical lesson on a fundamental concept in C++ programming: the use of void pointers. It effectively contrasts the behavior of C and C++ when dealing with type conversions, highlighting the stricter type safety in C++. The instructor uses a combination of visual aids, code examples, and a live coding demonstration to explain the problem and its solution. The key takeaway is that while a `void *` pointer can store the address of any data type, it must be explicitly cast to a specific pointer type before it can be used to access the data, a crucial rule for writing safe and portable C++ code.