Question
IM HAVING AN ISSUE WITH BUFFER OVERFLOW USING ECLIPSE C++ INTERFACE ,,, here is the code to get user input and reverse the string but
IM HAVING AN ISSUE WITH BUFFER OVERFLOW USING ECLIPSE C++ INTERFACE ,,, here is the code to get user input and reverse the string but if i enter more than 14 characters I have an issue with my program.. any help appreciated
/* * ReversedStrings.cpp * * Created on: Sep 25, 2018 * Author: malek */
#include
cout << "Enter a string : "; cin.getline(str,14);
j = strlen(str) - 1; for (i = 0; i < j; i++,j--) { temp = str[i]; str[i] = str[j]; str[j] = temp; } cout << " Reverse string : " << str << endl; cout <<" "; cout <<"Would you like to enter another String? Enter Y to Continue or press X to exit."< } while (cSel != 'X'); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started