Strings In C: C Tutorial In Hindi #34

preview_player
Показать описание
In this series of C programming tutorial videos, I have explained you everything you need to know about C language. I hope you are enjoying this C course in Hindi.

Best Hindi Videos For Learning Programming:

Follow Me On Social Media
Рекомендации по теме
Комментарии
Автор

str[5] can only store 5 characters. The strinng (or character array) "hello" has 5 characters so there's no space for the null character(\0).

For those who are wondering that by using double quotes ("") the compiler will automatically add a null character(\0) should remember that altough it's true but the compiler will need an extra space in that array to store the null character(\0) which is limited in the character array str.

Hope I am right...

pythonkrishna
Автор

The array str is declared with a size of 5 (char str[5];), which means it can store only 4 characters plus the null terminator ('\0'). However, the string "hello" has 5 characters.

adityadoijad
Автор

Str[5 ] can store only 5 characters while the string ''hello'' itself has 5 character. hence, there is no space for \0(null character) .

tokyotalkiesfromINDA
Автор

How could someone be this much nice..I mean teaching for free all the concepts and that too in understanble form...applaudssss🎉

triptipal
Автор

The str[5] is a character array that can store 5 elements, but to store 'harry' 6 characters are required.

srinibaspanigrahi
Автор

(edited)
9:24 Because it's a C program and you can't assign a string into an array of characters like this.

str = "hello"; ❌
str[6] = "hello"; ✔️

heeru
Автор

str[5] is an array that can store upto 5 characters only. h e l l o is 5 characters, since the 6th character is a null character the array size has t be 6. Hence, str[6] should be used for storing h e l l o.

twinklerambhia
Автор

Have tried many videos but your ones are short and simple and to the point. Thank you for making such a quality content harry bhai

dibyochowdhury
Автор

char str[5];
str="hello";
str is a constant pointer to str[0] and its value is not modifiable; if str[0] is modified first then this constant pointer can be modified

priyanujbora
Автор

Please note that the gets function is considered unsafe and has been deprecated in newer versions of the C standard due to potential buffer overflow vulnerabilities. SO better use fgets( str, sizeof(str), stdin);

chirntn
Автор

02:43 Strings are not a data type in C programming, but they can be represented using character arrays.
05:26 A string in C is an array of characters terminated by a null character.
08:09 C programming uses character arrays to represent strings.
10:52 In C programming, strings are null-terminated character arrays.
13:35 Using arrays to model strings in C and printing them using %s or putsstr
16:18 Explanation of character arrays in C
19:01 Understanding string handling in C
21:37 Different ways to print strings in C

taufiqueanwarkhan
Автор

str[5], str="hello" we are unable to store this "hello" into str[5] array. the reason is "\0" we are not adding null character into this array.

gorakhraut
Автор

#include<stdio.h>

int main()
{
char str[6] = "PAVAN";

for(int i=0; i<=5;i++)
{
printf("%c", str[i]);
}
return 0;
}
//Simple program for understanding ❤

PR_Pavan
Автор

9:46
Because in this type of syntax the compiler automatically takes the \0 which requires an extra memory location so that's why it should be str[6]

proteansan
Автор

The size of array of string should be greater than 1 from actual size of array to store null character (\0) ie. Ln+1

yogeshkolate
Автор

char str[5];
str ="harry"; we cant assign an array like this coz its a pointer and that is constant always

hritavsinghsolanki
Автор

Harry bro Mene aap ka 15 hours ka c_language ka pura video dekha he
Esh tutorial me aap bohot fast pass rhe ho

vishalsoner
Автор

Quiz answer : Because there is no space to accomodate the null character.

mohammed-i
Автор

The str[5] represents an array which only stores 5 character and hence to make it a proper string we have to increase the length by 1 to store the null value too. That will make it a perfect string and hence then it will print harry and run without creating an issue

tishagupta
Автор

this lecture really help me a lot bhaiya to learn about strings very clearly. thanks a lot bhaiya for your videos and appreciable effort.

vaishnavisharma