Reverse String Without Built-in Functions
Duration: 3 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- Behavioral Assessment (Psychometric): Behavioral Assessment (Behavioral Competency Profiling) (Psychometric Test)
- Cognitive Assessment (Game-Based): Gamified / Game Based Aptitude Selection Decision Table (Decision Making) Puzzle Solving (Puzzles) Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning) Analytical Reasoning (Counting Figures Reasoning) Cubes & Dices Coding Decoding Ranking, Order and Sequence Series (Number and Letter Series) (Numerical Relations and Reasoning)
- Common Applications & MS Office (Technical Assessment): MS Office by Yash Sir
- Pseudo Code (Technical Assessment): Pseudo Codes
- Networking, Security & Cloud (Technical Assessment): 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 Cloud Computing and IoT Cyber and Info Security Emerging Tech Trends
- Python (Technical Assessment): Python for Placements by Yash Sir
- Java (Technical Assessment): Java
- OOPs (Technical Assessment): Object Oriented Programming (OOPS)
- Data Structure (Coding Round): Introduction to DS Array Stack Queue Linked List Tree Graphs Hashing
- Algorithms (Coding Round): Algorithm Analysis Sorting Algorithms Greedy Algorithms Dynamic Programming Minimum Spanning Trees Shortest Path Algos Time Complexity Analysis Advanced Algorithms
- Coding Assessment Questions: C Programming by Yash Sir Coding Questions by Yash Sir Programming in C++
- SQL (Coding Round): SQL
- JavaScript Frontend (Coding Round): JavaScript
- Communication Test (Basic Verbal Ability): Vocabulary Sentence Construction Noun Pronoun Verb Tenses Subject Verb Agreement (Verb Noun Agreement) Articles Preposition Conjunction Adverb Modals Sentence Correction (Error Correction) Sentence Completion (Fill in the blanks) Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions) Communication Assessment
- HR Interview: MR & HR Interview Preparation
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This video is a programming tutorial from Knowledge Gate, focusing on how to reverse a string without using built-in library functions. The instructor begins by stating the problem: 'Write a program to reverse a string without using inbuilt string reverse library functions'. He then uses a chalkboard to illustrate the concept with the string 'single', showing the process of swapping characters from the start and end of the string, moving towards the center. The core method demonstrated is the two-pointer technique, where a temporary variable is used to swap the characters at the start and end indices. The lesson transitions to a code editor, where the instructor writes a C function named 'reverseArray' that implements this logic. The function takes a character array and two integer indices, start and end, and uses a while loop to swap elements until the pointers meet. The instructor explains the code line by line, including the use of a temporary variable 'temp' to hold the value of the start character during the swap, and the increment of the start pointer and decrement of the end pointer. The video concludes with the complete, functional code for reversing a string.
Chapters
0:00 – 2:00 00:00-02:00
The video opens with the Knowledge Gate logo, followed by a title card for a programming lecture. The instructor, Yash Jain Sir, introduces the topic: 'Write a program to reverse a string without using inbuilt string reverse library functions'. He then uses a chalkboard to visually explain the concept. He writes the string 'single' and draws a box around it, then illustrates the process of reversing it by showing a curved arrow that swaps the first and last characters, then the second and second-to-last, and so on. He writes the reversed string 'elgnis' below the original to demonstrate the final result. The instructor explains that this is a common interview question and that the method involves swapping characters from the beginning and end of the string, moving towards the center.
2:00 – 3:25 02:00-03:25
The instructor transitions from the chalkboard to a code editor to implement the string reversal algorithm. He writes a C function named 'void reverseArray(char arr[], int start, int end)'. He explains the function's parameters: a character array and two integer indices. He then writes a while loop: 'while (start < end)'. Inside the loop, he demonstrates the swapping process. He first declares a temporary variable: 'int temp = arr[start];'. He then performs the swap: 'arr[start] = arr[end];' and 'arr[end] = temp;'. He explains that this is the standard way to swap two values. Finally, he increments the start pointer and decrements the end pointer: 'start++;' and 'end--;'. He concludes by showing the complete function, which efficiently reverses the string in-place.
The video provides a clear, step-by-step tutorial on reversing a string without built-in functions. It begins with a conceptual explanation using a chalkboard to illustrate the two-pointer swap method, making the logic intuitive. This is followed by a practical implementation in C, where the instructor writes and explains the code for a function that performs the reversal. The synthesis of visual demonstration and code implementation effectively teaches the core algorithm, which is a fundamental concept in programming interviews.

