Count number of words in a string in c programming language | by Sanjay Gupta

  Рет қаралды 28,048

Sanjay Gupta Tech School

Sanjay Gupta Tech School

Күн бұрын

Пікірлер: 31
@ByteDesk
@ByteDesk 5 жыл бұрын
If no. Of spaces is more than one between two words then??? Ex. My name is Satyendra singh Count no. Of words
@SanjayGuptaTechSchool
@SanjayGuptaTechSchool 5 жыл бұрын
This programs only checks single space. As per your input different logic is required.
@laxmandarji9795
@laxmandarji9795 5 жыл бұрын
Void main() { Int i,count; char str[100]; gets(str); count=(str[0]=' ')?0:1; for(i=0;str[i]!='\0';i++) If(str[i]==' ' && str[i+1]!=' ') count++; Printf("%d",count);. // Words }
@saladasss419
@saladasss419 4 жыл бұрын
@@laxmandarji9795 can u do my problem pls? i have something related to this and i need ur help
@soubhagyapanigrahi724
@soubhagyapanigrahi724 2 жыл бұрын
Appreciate the effort you are keeping here, Would be great if you can change the heading of the video with proper conditional statements. or else it is misleading.
@SanjayGuptaTechSchool
@SanjayGuptaTechSchool 2 жыл бұрын
Can you please mention this with example. What exactly needs to be improved.
@AnuragRawat01
@AnuragRawat01 Жыл бұрын
But what if user input two spaces or more than two then output will be wrong
@SanjayGuptaTechSchool
@SanjayGuptaTechSchool Жыл бұрын
I created it assuming one space between words.
@AnuragRawat01
@AnuragRawat01 Жыл бұрын
@@SanjayGuptaTechSchool oo yaaa then it's alright 😊😊😊😊
@streamungodlyhour676
@streamungodlyhour676 4 жыл бұрын
what's the return 0 for? btw thanks for the tutorial! helped a lot
@SanjayGuptaTechSchool
@SanjayGuptaTechSchool 4 жыл бұрын
It is because return type of main is int but if we are using dev cpp compiler then it is optional so you can remove that line. And thanks for appreciating.
@shashwat-d5c
@shashwat-d5c Жыл бұрын
can u be my wild wife on bed
@sharma3226
@sharma3226 2 жыл бұрын
Sir could you Pleasee guide me how to sort number of frequent words used in pdf document. because i want to learn the most important major words for exam would be very helpful 🙏🏽🙏🏽.
@dizipatel8914
@dizipatel8914 3 жыл бұрын
This logic are completely wrong bcz space between two words are not exactly and ever one. Sometimes more spaces are available between the words then this logic going to be wrong.
@MayankGupta015
@MayankGupta015 4 жыл бұрын
What if space is first and also space at last it gives wrong output.. anyone please
@mayakumari.8158
@mayakumari.8158 4 жыл бұрын
This program is not appropriate to count the total number of word in a strong.... If I started to write our string after three space or more than one space this program will not work..
@SanjayGuptaTechSchool
@SanjayGuptaTechSchool 4 жыл бұрын
This program is written for standard input expecting only one space between words. If you want to give any no of space in between words then diff logic is required.
@mayakumari.8158
@mayakumari.8158 4 жыл бұрын
@@SanjayGuptaTechSchool Sir can you give me the logic of that type of program
@SanjayGuptaTechSchool
@SanjayGuptaTechSchool 4 жыл бұрын
for (i = 0;s[i] != '\0';i++) { if (s[i] == ' ' && s[i+1] != ' ') count++; }
@bhanusivapavansurath5849
@bhanusivapavansurath5849 4 жыл бұрын
@@SanjayGuptaTechSchool super sir
@laibanoor7971
@laibanoor7971 4 жыл бұрын
Zabrdst
@karthickeyann245
@karthickeyann245 2 жыл бұрын
Mass
@shaima1175
@shaima1175 3 жыл бұрын
What is meaning of this "\0"
@SanjayGuptaTechSchool
@SanjayGuptaTechSchool 3 жыл бұрын
This is null character which automatically stores at the end of string. It denotes end of string.
@disha_0605
@disha_0605 6 ай бұрын
This code is wrong
@aryankalpanshah
@aryankalpanshah 5 жыл бұрын
your program is wrong Sir!!
@SanjayGuptaTechSchool
@SanjayGuptaTechSchool 5 жыл бұрын
Why?
@aryankalpanshah
@aryankalpanshah 5 жыл бұрын
@@SanjayGuptaTechSchool Sir because if I want give more than one space b/w 2 words than this program fail to give correct output.
@SanjayGuptaTechSchool
@SanjayGuptaTechSchool 5 жыл бұрын
@@aryankalpanshah yes it is for one space only.
@chetanaggarwal259
@chetanaggarwal259 4 жыл бұрын
worst approach Suppose in a string there multiple spaces between two words then ................................???
@SanjayGuptaTechSchool
@SanjayGuptaTechSchool 4 жыл бұрын
This example is implemented assuming there is only one space between words.
Count Number of spaces in a string in c programming language | by Sanjay Gupta
3:22
Counting Occurrences Of A Word In A String | C Programming Example
14:56
Portfolio Courses
Рет қаралды 18 М.
Сюрприз для Златы на день рождения
00:10
Victoria Portfolio
Рет қаралды 2,8 МЛН
Миллионер | 2 - серия
16:04
Million Show
Рет қаралды 1,8 МЛН
бабл ти гель для душа // Eva mash
01:00
EVA mash
Рет қаралды 4,5 МЛН
I tricked MrBeast into giving me his channel
00:58
Jesser
Рет қаралды 25 МЛН
the TRUTH about C++ (is it worth your time?)
3:17
Low Level
Рет қаралды 742 М.
Count The Words In A String | C Programming Example
8:08
Portfolio Courses
Рет қаралды 12 М.
C in 100 Seconds
2:25
Fireship
Рет қаралды 3,1 МЛН
C Program to count words in a sentence
29:24
MySirG.com
Рет қаралды 71 М.
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
Сюрприз для Златы на день рождения
00:10
Victoria Portfolio
Рет қаралды 2,8 МЛН