Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 1
What is wrong with this code can any one tell me
2 Respostas
+ 3
Hi, Viraj Yadav !
Why: charctr=1;
Why not: charctr = 0;
In loop. Why theese quotes?
if(ch==ā ā||ch==ā\nā)
Shouldenāt it be:
if (ch == ' ' || ch = '\n')
+ 3
Viraj Yadav I see a few errors.
Ā Ā Ā file*fptr;
should be
Ā Ā Ā FILE *fptr;
getc() returns an int, but ch is declared as char. In order to compare ch with EOF, ch should be declared as an int.
Line 24 needs to use normal single quotes, not backticks.
I think that in line 34 it should subtract 1, not 2 from wrd. Better yet, initialize both wrd and charctr to 0, so that you won't have to subtract 1.
The code formatting could be improved with more customary indentation where you increase the indent where a basic block is nested and then restore the indent back to the containing block at the end of the nested block.