Formatted String Output + Suppression Character
Duration: 13 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- Quantitative Ability: Speed Mathematics and Basic Mathematics, Percentage, Ratio and Proportion (Ratios), Average, Profit and Loss, Simple Interest and Compound Interest, Time and Work, Pipe and Cistern, Speed Time and Distance, Number System, HCF LCM, Data Interpretation, Age Problems, Mixture and Alligation, Partnership, Algebra, Sequence and Series (Series), Mensuration and Geometry, Arithmetic
- Reasoning Ability: Puzzle Solving (Puzzles), Seating Arrangements, Coding Decoding, Blood Relations, Directions (Direction Test), Syllogisms, Data Sufficiency, Ranking, Order and Sequence, Series (Number and Letter Series) (Numerical Relations and Reasoning), Logical Sequence Of Words, Calendar, Clock, Cubes & Dices, Analytical Reasoning (Counting Figures Reasoning), Data Arrangement, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning)
- Verbal Ability: Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Cloze Test (Cloze Passage), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Vocabulary, Sentence Completion (Fill in the blanks), Active Passive Voice (Voice), Direct and Indirect Speech, Subject Verb Agreement (Verb Noun Agreement), Tenses, Preposition, Articles, Sentence Correction (Error Correction)
- Programming Basics (MCQs + Interview): C Programming by Yash Sir, Programming in C++, Java, Python for Placements by Yash Sir
- OOPs (MCQs + Interview): Object Oriented Programming (OOPS)
- DBMS (MCQs + Interview): Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Transaction Management, Decomposition Properties & 4NF, Concurrency Control, Database Recovery, File Organization & Indexing, Relational Algebra, Database Security & Authorization
- SQL (MCQs + Interview): SQL
- Operating Systems (MCQs + Interview): Introduction to OS, Process Management, CPU Scheduling, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Process Synchronization, Disc Scheduling, File Management, Security
- Computer Networks (MCQs + Interview): 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
- Coding: Coding Questions by Yash Sir
- HR Interview: MR & HR Interview Preparation
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This educational video is a lecture on C programming, specifically focusing on the behavior of the printf function with format specifiers for strings and integers. The instructor begins by introducing the topic of C programming MCQs and then delves into the concept of precision in the printf function, using the format specifier %.3s. He explains that this specifier limits the output to a maximum of three characters from the string, even if the string is longer, and demonstrates this with the string "abcdef". The lecture then transitions to a more complex example involving the scanf function with the format specifier %*d, which is used to read an integer but discard it (i.e., not store it in a variable). The instructor uses this to illustrate a common source of bugs in C programming, where an incorrect format string can lead to undefined behavior, such as reading garbage values. The video concludes with a final example of a C program that uses scanf and printf, and the instructor walks through the logic of the program to determine its output when given specific inputs.
Chapters
0:00 – 2:00 00:00-02:00
The video opens with a title slide for a C programming MCQs lecture by Yash Jain. The instructor then transitions to a blackboard-style presentation, where he begins to explain the printf function. He writes the code snippet `#include <stdio.h> int main() { printf("%.3s", "abcdef"); return 0; }` and starts to explain the format specifier `%.3s`. He uses the board to write the number `3` and explains that this number represents the precision, which limits the number of characters printed from the string. He also writes the word "overall" and "decimal" to describe the components of the format specifier.
2:00 – 5:00 02:00-05:00
The instructor continues to explain the `%.3s` format specifier. He writes the number `4.2` on the board and explains that the `4` represents the minimum field width, and the `.2` represents the precision. He then circles the `3` in `%.3s` and explains that this is the precision, which limits the number of characters printed. He writes the word "max" and "char" to indicate that the precision is the maximum number of characters that can be printed. He also writes the word "overall" and "min" to describe the components of the format specifier. He then writes the word "exact" to indicate that the precision is the exact number of characters that will be printed.
5:00 – 10:00 05:00-10:00
The instructor moves on to a new example, writing the code snippet `#include <stdio.h> int main() { int a, b, c; scanf("%*d%d", &a, &b, &c); printf("%d %d %d", a, b, c); return 0; }`. He explains that the format specifier `%*d` is used to read an integer but discard it, meaning it will not be stored in a variable. He writes the word "suppression" and "character" to describe the `*` in the format specifier. He then explains that the `*` is used to suppress the input, meaning it will not be stored in a variable. He writes the word "garbage" to indicate that the value of `a` will be garbage because it was not stored. He also writes the word "min" and "max" to describe the components of the format specifier.
10:00 – 13:14 10:00-13:14
The instructor presents a final example, writing the code snippet `#include <stdio.h> int main() { int a, b, c; scanf("%*d%d", &a, &b, &c); printf("%d %d %d", a, b, c); return 0; }`. He explains that the format specifier `%*d` is used to read an integer but discard it, meaning it will not be stored in a variable. He then explains that the `*` is used to suppress the input, meaning it will not be stored in a variable. He writes the word "garbage" to indicate that the value of `a` will be garbage because it was not stored. He also writes the word "min" and "max" to describe the components of the format specifier. He then explains that the `*` is used to suppress the input, meaning it will not be stored in a variable. He writes the word "garbage" to indicate that the value of `a` will be garbage because it was not stored. He also writes the word "min" and "max" to describe the components of the format specifier.
The video provides a comprehensive lecture on C programming, focusing on the nuances of format specifiers in the printf and scanf functions. The instructor effectively uses a blackboard-style presentation to break down complex concepts into digestible parts. The core of the lesson revolves around the precision specifier in printf, demonstrating how it limits the number of characters printed from a string. The video then transitions to a more advanced topic, illustrating the use of the `*` in scanf to suppress input, which is a common source of bugs. The instructor's methodical approach, combining code examples with on-screen annotations, makes the material accessible and reinforces key concepts for students preparing for exams like GATE and Accenture.