- 1

#include <stdio.h> #include <string.h> int main() {    string alien;    scanf("%s",alien); strrev(alien); printf("%s",alie

What is the error in this code

11th Aug 2020, 1:07 PM
PRABHU D
PRABHU D - avatar
11 Answers
+ 5
Your program have errors u cannot take input like this and string is not any data data type u write string alien its wrong . You have not used printf and scanf properly in program see this example #include <bits/stdc++.h> using namespace std; int main() {     string str = "Hello world";       // Reverse str[begin..end]     reverse(str.begin(), str.end());     cout << str;     return 0; }
12th Aug 2020, 12:01 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 4
You have just started the C course! There's nothing called string in C Make a char array
11th Aug 2020, 1:21 PM
Namit Jain
Namit Jain - avatar
+ 4
if u want to take input from user u can use gets() function
12th Aug 2020, 12:04 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 4
You forget & address in scanf
13th Aug 2020, 5:14 AM
Durdona Jakbaraliyeva
Durdona Jakbaraliyeva - avatar
+ 2
You don't have string data types in C..... You can write char* alien; printf("%s", &alien); 🙄
13th Aug 2020, 10:31 AM
Sanjay Kamath
Sanjay Kamath - avatar
0
the last line of your code doesn't have a bracket. the alien string on the second printf isn't complete, I mean the complier didn't found 'alie' variable. more errors could be there since I don't use C.
11th Aug 2020, 1:15 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
#include <stdio.h> #include <string.h> int main() {    string alien;    scanf("%s",alien); strrev(alien); printf("%s",alien); return 0; }
11th Aug 2020, 1:18 PM
PRABHU D
PRABHU D - avatar
0
Still not working stray/302 error
11th Aug 2020, 1:18 PM
PRABHU D
PRABHU D - avatar