Remove Spaces from String | Logical Programming in C | Naresh IT
ฝัง
- เผยแพร่เมื่อ 26 ส.ค. 2024
- ** For Online Training Registration: goo.gl/r6kJbB ► Call: +91-8179191999
Subscribe to our channel and hit the bell 🔔🔔🔔 icon to get video updates.
💡 Visit Our Websites
For Classroom Training : nareshit.in/c-...
For Online Training : nareshit.com/c...
--------------------------
💡 About NareshIT:
"Naresh IT is having 14+ years of experience in software training industry and the best Software Training Institute for online training, classroom training, weekend training, corporate training of Hadoop, Salesforce, AWS, DevOps, Spark, Data Science, Python, Tableau, RPA , Java, C#.NET, ASP.NET, Oracle, Testing Tools, Silver light, Linq, SQL Server, Selenium, Android, iPhone, C Language, C++, PHP and Digital Marketing in USA, Hyderabad, Chennai and Vijayawada, Bangalore India which provides online training across all the locations
--------------------------
💡 Our Online Training Features:
🎈 Training with Real-Time Experts
🎈 Industry Specific Scenario’s
🎈 Flexible Timings
🎈 Soft Copy of Material
🎈 Share Videos of each and every session.
--------------------------
💡 Please write back to us at
📧 us.training@nareshit.com/ 📧 online@nareshit.com or Call us at the USA: ☎+1404-232-9879 or India: ☎ +918179191999
--------------------------
💡 Check The Below Links
► For Course Reg: goo.gl/r6kJbB
► Subscribe to Our Channel: goo.gl/q9ozyG
► Circle us on G+: plus.google.co...
► Like us on Facebook: / nareshit
► Follow us on Twitter: / nareshitek
► Follow us on Linkedin: goo.gl/CRBZ5F
► Follow us on Instagram: goo.gl/3UXYK3
Two spaces can exist adjacently, to overcome this problem we must put i--; in the if statement's body.
Can u provide the code please
I also have same priblem
Sir you already said in strings handling videos part 2 ..that strlen function gives the length of the string " Excluding null character" But in this you explained that alternatively...which one is correct sir...🤔🤔
Same doubt for me also before what he said strlen is use to give string length excluding null but in this vedio he is considering with null character also😳😳
@@ramadevimadaka7832 I guess array is with null character but string length is with null character
length is 5(excluding null)
size is 6(including null)
Same doubt for me
But the stringlen will give without counting null . The program is crt
Bro,keep putting more videos,u are clear explainer...thank you so much
There is a error in the code if we simply use strlen after we get the input through scanf function where the string has spaces the string length will be only upto the character before the spaces. eg for ( a space b) strlen will be only 1 not 3.
nice explanation
#include
#include
int main() {
char inputString[100], outputString[100];
int i, j;
printf("Enter a string with spaces: ");
fgets(inputString, sizeof(inputString), stdin);
for (i = 0, j = 0; inputString[i] != '\0'; i++) {
if (inputString[i] != ' ') {
outputString[j++] = inputString[i];
}
}
outputString[j] = '\0';
printf("String without spaces: %s
", outputString);
return 0;
}
its the correct code for this question
Great explaination Sir
Thank you so much Sir
🙏🙏🙏🙏🙏🙏🙏🙏
Hiii sir .....
Tq Soo much sir .... E videos naku chalaaa help indi..
Sir meru '.net ' cheputaraa....?
I think strlen function returns the length of the string except null character
Ty sir great explanation, was looking for this❤
everything was perfect but strlen does not count null character so the lenght would be 5 only
great explanation and more effeftive video in youtube .🤟🏼🤟🏼
Sir how to shift hyphen to front of the string? Please make a video of this. I'm giving an example:
input: hello-hi-there
output: --hellohithere
PLease please make a video of this.
thank you very much sir for this video
Code is wrong
great explaination. cool and chill
Sir,
What will happen if there is 2 or more adjacent spaces?
Please explain sir
wo dekhte hi i opened comments. yes its true program there will fail
Thank you so much!!!
#include
#include
int main() {
char input[100], output[100];
int i, j;
printf("Enter a string: ");
gets(input);
for (i = 0, j = 0; i < strlen(input); i++) {
if (input[i] != ' ') {
output[j] = input[i];
j++;
}
}
output[j] = '\0';
printf("String without spaces: %s
", output);
return 0;
}
Correct code
please use some dark marker
This code doesn't work for two or more spaces in between string or at start for eg. if a string is : i am a student then output is : i amastudent ....
one space is still present. kindly provide solution for this.
Wrng for loop conditions
Bro check once
write a function to remove slash from two string and call that function from strcmp function and compare it in c programming??
Sir do a video on string rev without using string functions
#include
#include
int
main() {
int i,j;
int s;
int a[5];
printf("enter five numbers");
for(i=0;i=0;j--)
printf(" %d",a[j]);
}
Take the help of this logic
well explained
Gets function is not allowed in c sir
Not working
Sir achha marker use kiya kijiye plzz
I have done this using a continue function which reduces time and easy logic.
char a[100],i;
printf("Enter a string
");
gets(a);
for(i=0;a[i]!='\0';i++)
{
if(a[i]==' '&&a[i+1]==' ')
continue;
printf("%c",a[i]);
}
there is a small mistake in the code