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
- TCS One Shot Free Videos & Notes: TCS Preparation
- Numerical Ability (Foundation Section): Ratio and Proportion (Ratios), Divisibility Rules, Data Interpretation, Mixture and Alligation, Permutation and Combination, Logarithm, Number System, HCF LCM, Sequence and Series (Series), Speed Time and Distance, Percentage, Average, Powers and Exponents (Surds and Indices), Algebra, Probability, Profit and Loss, Simple Interest and Compound Interest, Time and Work, Pipe and Cistern, Mensuration and Geometry, Mental Ability, Age Problems, Statistics, Arithmetic, Partnership, Speed Mathematics and Basic Mathematics
- Reasoning Ability (Foundation Section): Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Syllogisms, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Seating Arrangements, Blood Relations, Directions (Direction Test), Analytical Reasoning (Counting Figures Reasoning), Puzzle Solving (Puzzles), Calendar, Clock, Cubes & Dices, Selection Decision Table (Decision Making), Crypt Arithmetic, Venn Diagram, Data Arrangement, Inequality, Analogy, Ranking, Order and Sequence, Logical Sequence Of Words
- New Pattern-Verbal Ability (Foundation Section): Sentence Completion (Fill in the blanks), English Writing Ability
- Old Pattern-Verbal Ability (Foundation Section): Vocabulary, Noun, Subject Verb Agreement (Verb Noun Agreement), Adjectives, Tenses, Pronoun, Preposition, Articles, Direct and Indirect Speech, Conjunction, Modals, Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Sentence Correction (Error Correction), Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Verbal Analogy (Word Based Analogy), Active Passive Voice (Voice), Determiner, Facts, Inference and Judgements, Adverb, Cloze Test (Cloze Passage), Sentence Construction, Verb
- Advanced Quantitative Ability: TCS NQT Advanced Quantitative Ability
- Advanced Reasoning Ability: TCS NQT Advanced Reasoning Ability
- Advanced Coding: Coding Questions by Yash Sir, C Programming by Yash Sir, Python for Placements by Yash Sir, DSA using Python, Object Oriented Programming (OOPS), Programming in C++, Java
- TCS Full Length Mock Test:
- TCS Interview & Resume Prep: MR & HR Interview Preparation, TCS Interview Preparation, Mock Interview, Interview Recordings, Resume Preparation, Resume Review
- Mega Test:
- Grand Test:
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.

