Please Comment, Subscribe and Click Bell🔔🔔🔔 Icon for More Updates. To learn software course from our experts please register here for online training: goo.gl/HIB0wL
Sir I need a program which display sms send and sms received by using functions sir. Please tell me how to write the code. I tried sir but I didn't write that. Please help me sir
Hey Srinivas sir the teachers like you are the reason of why Indians are best in the world !! I was searching for the string functions for so long time i got it from your channel and i understannd it very well thankyou so much for making videos!
Here is the complete code of finding length: #include int stringlength(char []); main() { char str[30]; int len; printf("enter the string: "); gets(str); printf("name is %s ",str); len=stringlength(str); printf("length of %s is %d",str,len); } int stringlength(char x[]) { int i=0,count=0; while(x[i]!='\0') { count++; i++; } return count; }
sir, in string reverse program, u said that j=strlen(x). it is wrong, because if we use like this it will give the location of null character, then o/p will be wrong. So we should use j=(strlen (x)-1). Then only it will give the location for the last character of a given string.
On program reverse all elements in a string we need to len=strlen(str) -1; Because -- if the string is -- "Hey" len is 3, with NULL being 4; Now every array starts with 0 index. Thus H=0, E=1, Y=2, '\0'=3 now if j=strlen=3, Here 3 is NULL Thus when we reverse it, NULL gets the first location. And we try to print it. It gets terminated in the first index itself. I used GDB to figure out the bug.
In example to reverse the string J is holding strlen(x) so for 'NARESH' it would be 6 excluding NULL character. Hence in swapping x[i] needs to be swapped by x[ j-1 ] that x[0] is to be swapped by x[5]. REST IS GREAT
@@theodordumitrache6055 because the index starts from 0 ,which is known thing for us. In case of strlen while finding string length it starts from 1. For ex: if the string is "moon", normally index starts from 0 and length is 3 but if we use strlen then it shows length is 4 and this causes error. so in order to avoid that we should use strlen(x)-1.
No, it will work just fine, as strlen counts the elements until it reaches the null character, in which case it will stop counting. It won't include it with the length
At 15:56 it should be j = strlen(x) - 1; Because in string length it will be included '\0' as a last char in a string, so it will be swapped as well, and it will end up on i[0]! Impossible to work like that! And at 25:46 you have to add another set of brackets on those conditions!
@@radhasaradhi5959 No strlen does swap '\0' in the string to the 1st position, which means it terminates the whole string. Therefore j = strlen( str ) - 1 ;
Really, you are great sir . Your teaching technique is very unique. Now, I can easily understand Array, string ......thank you so much ... It is very helpful for me as well as for other students also . Those who are facing problems in C programming language... Once again thank you sir.🥰☺️☺️☺️🙏🙏🙏🙏🙏🙏
Guyzz you may have the doubt in string reverse process then here it is the code... #include #include void main() { char str[100],temp; int i,j=0; printf("nEnter the string :"); gets(str); i=0; j=strlen(str)-1; while(i='A'&&x[i]
I cannot tell you how grateful I m... Thank you for teaching these topics so so so nicely! I don't know what I would have done if your videos weren't there.... Just so you know... Your videos are the best out there for c.. #Thank you...
Here is the complete code of reversing the string: #include int strlength(char[]); main() { int len; char x[30]; printf("enter the string: "); gets(x); printf(" string is %s",x); len = strlength(x); printf(" length of string is %d",len); printf(" now the swapping starts "); int i=0, j=strlength(x)-1; char c; while(i
At 25.40 (time), The expression is x[i]=x["%d",i]+32 or a[i]=("%d",a[i])+32; because the character can't be added to an integer.Take care of this brothers and sisters otherwise the console will print an error message.
While swapping 2 string we are assigned j as strlen(x), but in string Naresh it comes 6 and in Annie it comes 5. But sir, you take it as 5 and 4? Then how we can take j=strlen(x) ?
You can try this for merging two strings: #include #include void main() { char s1[30],s2[30]; int i,len1,len2; printf("Enter first string :"); gets(s1); printf("Enter second string :"); gets(s2); len1=strlen(s1); len2=strlen(s2); printf(" Length of first string '%s' is :%d ",s1,len1); printf(" Length of second string '%s' is %d ",s2,len2); for(i=0;i
Sir thanks for your valuable words but I'm having small doubt at 25:53 seconds part in if condition we used && it means it should satisfy both conditions but it is not always possible as any letter is not =Z. So can we use 1)|| or symbol in it or 2)(x[i]>='A' && x[i]
hii sir in the program of reverse of a string the condition should be j=strlen(x)-1.bacause it is an array magnitude of i and j should be equal. #clear explanation.
Sir, i want to compare two strings..is it possible to compare two string values? As we know during reading of strings it will hold the address of that string rather than the value within that address.. Reply as soon as possible Sir !!
The C11 standard ISO/IEC 9899:2011 eliminated gets() as a standard function, which is A Good Thing™. Sadly, it will remain in libraries for many years (meaning 'decades') for reasons of backwards compatibility.
in swapping the character program what data type should be given to variable temp. Also what happens when multiple word string in read into the program.
You should never use gets function because it doesn't give error if you enter the string larger than 40 chars it will overwrite the next element in the memory with string.
This video goes after string part 1 and string part 2 in the playlist! so I think it's better if you watch according to that order if you are just a novice learner!!! Thank me later :P