Static Variables In C: C Tutorial In Hindi #42
Вставка
- Опубліковано 7 вер 2024
- 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.
►This C Lecture is a part of this C Programming Course: • C Language Tutorials I...
►Source Code + Notes: codewithharry....
►Click here to subscribe - / @codewithharry
Best Hindi Videos For Learning Programming:
►Learn Python In One Video - • Learn Python In Hindi ...
►Learn JavaScript in One Video - • JavaScript Tutorial
►Learn PHP In One Video - • Learn Php In One Video...
►Machine Learning Using Python - • Machine Learning Tutor...
►Creating & Hosting A Website (Tech Blog) Using Python - • [Hindi] Web Developmen...
►Advanced Python Tutorials - • Intermediate/Advanced ...
►Object Oriented Programming In Python - • Object Oriented Progra...
►Python Data Science and Big Data Tutorials - • Python Data Science an...
Follow Me On Social Media
►Website (created using Flask) - www.codewithha...
►Facebook - / codewithharry
►Instagram - / codewithharry
►Personal Facebook A/c - / geekyharis
Twitter - / haris_is_here
C programming ke is course ke end mei konsa project banaye? Any suggestions?
Hacking using C
Html parser ka solution kaha he sir
HTML parser program link: drive.google.com/file/d/1f9QvEGdmkYjqydd2PuQsZJ82M-mn_Z-7/view?usp=drivesdk
Sir mera program sahi he kya reply me
Sir project graphics base banana he ya console based ?
Aur bhaiya me anaconda use krta hoo uske saath vs code...to apke environment wali video wale commands anaconda se bne environment ko activate ni kr pa rhe he aur bhi bahot problem ho rhi he kya aap please un sbka solutiot bta skte ho
This Playlist is still the best and will be the best for a Long time!...
still true 💯💯
In this video
the global variable has declared outside of the main( ) function
I was thinking the same😅
this video was a little bit lengthy considering the logic explained......
loved it tho..
#include
int func()
{
static int age=0;
age ++;
printf("The age is %d
",age);
}
int main(){
printf("At birth:-
");
func();
printf("After 1 year
");
func();
printf("After 1 year
");
func();
}
example of local gunda is awesome.😀
Finally the realisation hit me that I should make notes only gonna watch with a note with me from now on. Great work Bhaiyya but HTML parser seems a bit tough for me but I'm trying it anyway.. Also in this I think you didn't go into detail about functions I'm trying to put user defined functions inside another user defined its not going well thx for this free course will spread the word once I finish the course and start to master C this course was the one that finally gave me confidence that I can pick up C lang I have 2 books on C but nothing helped me till I started this course .
No one:
Harry Bhai : mujhe ghumao mat XD
difference between static global variable & normal global variable in c.
difference between static function & normal function in c?
very nice, understood for the first time
Can u explain why the function is not returning b1 + myvar ; ? It must return because value of b =344 is passed to b1
And at last of fun1( ) it's written return b1 + myvar. ???
It will be printed if func1 is used within printf.
Like:
printf("The value returned from func1 is %d
", func1);
Then Output will be:
The value of myvar is 0
The value returned from func1 is 344
Hope it is clear now !
@@anubhav1020 Can u pls explain why its like that...Its returning the entire value b1+myvar. So it should store that full value in val right?
@@edwardellis7788yeah, it is storing. He just isn't printing val in the video.
@@edwardellis7788yes, if you will print val, you will get what you are looking for.
Why B1+myvar is not returning when function is being called?
It will be printed if func1 is used within printf.
Like:
printf("The value returned from func1 is %d
", func1);
Then Output will be:
The value of myvar is 0
The value returned from func1 is 344
Hope it is clear now !
@@anubhav1020 but what is you typed is returning a garbage value.
harry sir u are great😘🙌🙏
i didn't understand the " return b1 + myvar; " line. can anyone explain this , please??
int func1( int b1)
{
static int myvar=0;
printf("The value of myvar is : %d
", myvar);
myvar++;
return b1 + myvar;
}
Sir C language ke baad data structure please 🙂🙂
R u alive???
What are you doing??
AOT people watching this in 2021 be like "my var".
😂😅
Thanks Harry Bhaiya
func1() last me return kar raha hai `b1+myvar` okay. Then, in main() b = 344; Then why return the 98, 99, 100. instead of (344+98)=442,443 and so on. Please help regarding this
b1 + myvar return to ho rahe hai par wo main() function main kahin bhi print nhi ho rahe hai.
par func1() main sirf myvar print ho raha hai isliye sirf myvar ki value increment hokar printf ho rahi hai.
agar ye function printf ke andar likha hota to b1 + myvar print hota.
Bhohot Achha Samjaye Harry Bhai...
//here a is local variable of func() so we can not access it in main ()
//now b is global variable as it is declared outside any function we can access it anywhere but it is not proffered because the memory is occupied even if it is not in use
// int c is formal parameter of func and c is actual parameter now if c is declared as global parameter then local value of c is prefferd first and it is print on output
#include
int b = 10;
int c = 15;
int func(int c){
int a = 4;
printf("%d
",b);
printf("%d",c);
}
int main() {
int c =3;
//printf("%d",a);
printf("%d
",b);
func(c);
}
In func1 function, what return b1 + myvar does, Harry bhai!?
5:34 harry bhai and selmon bhoi😂😂
When i daclare the static function and putting the value after the declaration it print different
Static int a ;
a = 0 ; then it print same
it is very helpful thanks harry bhai..
Wwooowww I completed 42 videos 😵😵😵😱😱😱💖💖💖
Can u explain why the function is not returning b1 + myvar ; ? It must return because value of b =344 is passed to b1
And at last of fun1( ) it's written return b1 + myvar.
@@starkendeavours7072 bro if u have got the ans until now , so plz tell me
HARRY bhai A.I ki series chahiye
Baap of cmputer language 😎😎like the best teacher for coding
Thank you so much sir. very helpful video.
sir meri php ki problem solv nahi karai sir aapne . please help me . sir phele bhi aapse phucha tha maine.
sir php ke problem ye hai ki ek blog post me jb user comment ya like karta hai to with out user ke name and gmail ke like or comment nahi honi chahiye .sir ek blog post ki class karado na sir please help me .
Bilkul smjh me agya bro
You teach very well.
Great 👏👏👏😍😍
Thanks for your support sir
Please try to keep things clean. Sometimes you just comment out and that's where things get confusing. Remember bro we are beginners and if you do things in code so quickly we would get confused.
//global variable, g1=7;
//local variable ,g1=3;
Does this mean that the value of global variable has modified to 3 from 7?
no
No it depends on how u use them. For example, I have local g1=3 & global g1=7 &
if I am calling the function in which local g1=3 exists, then the value g1=3 will be considered, and if it doesn't exist then global variable g1=7 will be considered
so what about precedence of C language cause harry sir use the word precendence and in previous lecture harry sir told about the precedence it actually works like the handling of condition with the help of associativity @@SadhguruKnows
@@SadhguruKnows according to me it actually works on the basis of precedenc
At 19:44 it will be This is a global variable since it is declared outside main() . Please audience rectify the mistake. Thank You
Sir, Program type karne ke liye logic kaise lagaye?
I am watching c language in 2023 sir you have ossame explain whole c laguage thank you so much
Bhaiya, I feel that in this comment inside should be replace by outside.
// This is a global variable since it is declared inside main()
main ke andar variable local hote hai... saare function ke bahar global
Enjoying the video series till now.
Great work :)
Local variable:Sachin kumavat
Global variable: BTS
😅😅 Right sir?
Please reply on it sir
Is it am I right or not....
explain, why output is not showing the value of ....return b1+myvar
Because you're not printing it?
Local gunda vikas dubey kanpur Wala 😂
Can you explain scope sir .
Please
I am understanding this
Bro apne last me ret() ko static int me input kiya wo toh work kar raha hai
Output:-
129
130
131
132
133
Ye aa raha hai
#include
int b = 34; // This is a global variable since it is declared inside main()
int ret()
{
return 43*3;
}
int func1(int b1)
{
static int myvar = ret();
printf("The value of myvar is %d
", myvar);
myvar++;
// printf("the value of b inside func1 is %d
", b);
// printf("The address of b inside func1 is %d
", &b);
return b1 + myvar;
}
int main()
{
int b = 344;
// printf("The address of b inside main is %d
", &b);
int val = func1(b);
val = func1(b);
val = func1(b);
val = func1(b);
val = func1(b);
int *ptr = &val;
// printf("The value of func1 is %d", val);
// printf("%d", loc);
return 0;
}
How? Apne toh kaha tha ki ret() static variable me intialize nahi hoga
Apke me toh dikhaya ki intialize nahi hoga sirf constant literal accept karega
Paar me wo code ko copy karke apne Cxxdroid app pe use kiya toh output aa raha hai
mene tera code copy karke dekha aur 3 online compiler mai chalaya teeno mai error deta hai jo harry ne bataya
yes. mere me bhi output aa raha hai instead of error. because abhi rules change ho gaye hai. ab compiler static variable ko compile time me bhi value assign kar sakta hai That's why you and I also don't receive any error in this programme.
sir apne bola ki static variables run time se oehle hi memory me store hojaate hein ....
per sir ager koi static variable function ke ander likha ho to vo kyaa tab bhi ?? pehle memory allocate krlege ... bina program us function tak pahoche ??
b1 ka value assign nahi hu tha sir static define karne ke baad kyun sir???
what if we use static variable in a union, the what will be the criteria for memory allocation?
same jab bina static use kiye hue tha
Sir Jaisa apne static variable me bataya ki static variable in function increment. But sir local variable increment Nahi hota hai function me when call function again again... Aisa kyon ..could u please tell me
Yahi tooh static variables ki property hai ....ki voo apni previous value yaad rkta hai .
LOCAL variables nhi yaad rkhte
I hope you got it.
Because Local variables destroy ho jaata hai function return k baad but static variables memory main save rehta hai until program execution is complete.
Woah.. awesome
Nice video
Plz start a course of c++
yes please!
good job harry bhai
Nice explanation Harry Bhai..
💕💕💕
Thanks sir
#include
void func(){
static int a=0;
a++;
printf(" %d day of weekend
",a);
}
int main(){
printf("monday :
");
func();
printf("tuesday :
");
func();
printf("wednesday:
");
func();
printf("thursday :
");
func();
printf("friday:
");
func();
printf("saturday :
");
func();
printf("sunday :
");
func();
return 0;
}
Great teacher for me online
Right
Disclaimer : no gabbar singh is injured in this video
😂😂
19:25
Outside*
/* Harry bro casually drops this legendary playlist */
harry bhai 4:48 iss pr jo screen par theme h, (high contrast + monokai) yey kesa lagay... yey batao
what about the b in the main function
In this program , what is need of "int *ptr=&var"?????
No use bro dont worry.
&b was used to show different address of actual and formal parameters. But storing value in pointer was of no use.
Harry bhai jab yaar
Format document karta hoo na toh notification aati hai ki document formatter not installed
So batao kaunsa formatter download kare
Install c cpp extension and code runner extension
Very nice explanation ! ❤🔥👍
Love this series
bhai ek video bubble sort pe ho jata toh maza aa jata
At 3:48 , it should be void func().
Why
@@seesshhhh2371 Because the function func() doesn't return any value. It only prints the value of the global variable.
What content are their in premium course of silver .im confuse about that
amazing..
Waise for global variables ko bhi for func1() nahi jhepega he will also say to give an exact value 🤔🤔
Global variables vi kya main() k run hone se pehle run hota hai?
aage videos kb aaa rhi hai c language pe exams suru hone wale hai jldi upload kriye sirr plz plz plz plzz
very nice harry sir
JavaScript ka course banao
great videos bhai!!
10.05 ,defination की तहत तो वैल्यू इनटैक्ट रहनी चाहिए थी।
Sir mera to sahi ho raha ha ?? my var k andar koi function put kr kr
console pr output show ho rha ha
Local variable: gully ka chapri ;
Global variable: you know what I'm talkin about;
thanks_Sir💜
harry bhai kya hum aise likh sakte hai ----- static int b = *ptr
//is it valid syntax
//please reply
Aap ka statment invalid hai bro.
Aap pointer main address ko store kar sakta ho.
Address main variable ko store kar sakta ho .
But, variable main address ko store nhi kar sakte 🙁😔
@@kanhakhushigupta7786 Yes, you are right. It's showing Initializer element is not constant
@@starkendeavours7072 😀☺️ thanks 🙏
Duniya pe bohut bade bade gunde h nam nehi lena chahuga ... That was epic 🤣🤣🤣
Achha hai sir
Sir aapka theory level programming understimte ho gaya is code ka ...but IDE par aap ke baat ka sense samajh nahi aaya...
what is CHATBOOT?
Hello sir
Can you start cyber security if possible
i understand only last 15 min, topic ..😶🌫
Basically (Statics function) garam masala movie ka paresh wala hai 😂
2:25
How many are watching in the end of 2021 ?????
Are variables pointers in c?? 🤔 Answer please
No all pointers are variable but not all variables are pointers
bhai ye adds🥲 or ye grammarly vala.. irrigating...
5:34 LOL
kisse ko idea hai kya ki output mai number of value galat aaye to kya kare
--
✅
HarryBhai ko lag raha hell se OsamaBinLaden & Abu Bakr Al Baghdadi bhi unke videos dekh rahe hei.😂😂😂..tabhi naam nhi liya
Global gunda- dawood ibrahim. 🤣🤣🤣🤣 HAARY SIR ME le leta hu naam aap nhi le skte ho , mention not 👍🏻👍🏻🤗
yeh video me kush samaj me nahi aaya, 2-3 baar dekha, bajut fast ho gaya sab
naam nahi lena chahunga 😂😂😂😂😂🤣