The code is running well but I have two issues.
Firstly, from the 3rd printf command, when I input a character, it jumps to the next instruction without me clicking enter.
Secondly, I'm trying to store the string elements in a new char array and print the new array but I'm having complications.
Code:#include <stdio.h>#include <conio.h>
#include <math.h>
#include <stdlib.h>
int main (void)
{
int N;
printf("insert the length of string\n");
scanf("%d", &N);
char v, u, str[N];
printf("insert the string element\n");
scanf("%s", str);
printf("insert a character from the element\n");
v = _getch();
printf("\n%c", v);
printf("\n");
printf("insert a character which you want to interchange with\n");
u = _getch();
printf("\n%c", u);
printf("\n");
int i;
for (i=0;str[i]!='\0'; i++){
if (str[i] == v){
str[i] = u;
}
else
continue;
}
printf("the values are:\n");
puts(str);
return 0;
}