What is wrong with this code? it is for my University practical assignment.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is wrong with this code? it is for my University practical assignment..

After a long time coding in C almost Forgot everything I find it very difficult.. help me correct the code #include <stdio.h> #include<string.h> #include<ctype.h> int main() { char str[1000],digit String[1000] = {0}; printf ("\nEnter the string:"); gets(str); char*ptr = strtok(str," "); while (ptr) { int len = strlen(ptr); bool integer = true ; for (int i=0; i<len;i++) { if(isdigit (ptr[i]! = true)) { integer = false; break ; } } if(integer ==true) { strcat(digit String,ptr); strcat(digit String," "); } ptr = strtok (NULL," ") ; } printf ("\n\n Integer numbers within the string are:"); puts(digitString) ; return 0; }

8th Oct 2021, 5:42 PM
Moon
Moon - avatar
3 Answers
+ 1
9th Oct 2021, 3:27 AM
zexu knub
zexu knub - avatar
0
C language doesn't have string & bool by default
8th Oct 2021, 5:50 PM
zexu knub
zexu knub - avatar
0
Okay
9th Oct 2021, 7:14 AM
Moon
Moon - avatar