0

I don't understand this coding, can anyone explain step by step. If possible then use Hindi please. I know little English

Can anyone suggest some more examples include <stdio.h> /* declaration */ int square (int num); int main() { int x, result; x = 5; result = square(x); printf("%d squared is %d\n", x, result); return 0; } /* definition */ int square (int num) { int y; y = num * num; return(y); }

29th Mar 2020, 5:12 PM
Jitendra Kumar
Jitendra Kumar - avatar
9 Antworten
+ 2
Part 2 of 5 function ke 4 part hai. 1. return type - agar function kuch calculations karta hai to uska result vo return karega aur ham us result ko function ke bahar, jaha se hamne function call kiya tha vaha use karenge. square function integer return karte hai isliye iska return type int likha hai. 2. function name - is naam ko use karke hum function ko call karenge. 3. parameter - iska use function ko kuch information dene ke liye karte hai. Is information ko function use kar sakta hai. Tumhare code main (int num) ek parameter hai. 4. function body - isme ham sabhi executable statements likte hai.
30th Mar 2020, 10:21 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
Part 3 of 5 int square (int num) { int y; y = num * num; return(y); } is function definition me `int` return type hai kyonki ye function `y` variable return karta hai jiska type integer hai. square is function ka name hai. int num , ye ek parameter hai. agar tum square ko aise call karo : square(3); to 3 ka value num ko assign ho jayega. next hamne "int y" variable define kiya hai. fir hum usko "num*num" calculate karke uska result y ko assign karte hai. y = num* num; badme ham "y" ko function se return karte hai taki ham ise function ke bahar use kar sake.
30th Mar 2020, 10:21 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
Part 4 of 5. Ab main function. do integer variable (x aur result) define kiye hai. x = 5; isse x ko 5 assign ho jayega. result = square(x); Ab bhai ye jara thik se samaz lo. yaha hamne square function ko x pass kiya hai. matlab hum square function ko kuch data send kar rahe hai. jaise ki maine pehle explain kiya hai, jo bhi value to square ko send karoge vo uske parameter (int num) ko assign ho jayegi. ab square function "x" ka x*x calculate karega aur use return karega. Ye return kiya hua value hum result variable ko assign karte hai. kuch is tarah: result = square(x); fir hum printf se x aur result ko print kar dete hai.
30th Mar 2020, 10:21 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
Part 5 of 5: Jitendra Kumar me jitna kar sakta tha utna explain kar diya hai. 😅 Ab tum apni aur se bhi puri koshish karo. Muze pata hai ye aasan nahi hai par agar tumhare andar karne ki chahat ho to ye munkin hai. Ye baat dhayan me rakho ki agar tumhari mehnat karne ki tayari *na* hoto tumhe koi nahi sikha sakta. Agar tayari hai to tum khud bhi sikh sakte ho. Aise aasan savalo ka javab apne aap dundne ki koshish karo. Aur English padhne likhne ki aadat kar lo 😅 Ye sab Hindi me complete nahi kiya ja sakta. "Let Us C by Yashwant Kanetkar" book read karo shayad usme se tum sab sikh paoge. Usme easy language me explain kiya hua hai. All the best 👍
30th Mar 2020, 10:31 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
OK thanks sir
30th Mar 2020, 10:43 AM
Jitendra Kumar
Jitendra Kumar - avatar
+ 1
Jitendra Kumar , Bhai is code ka kaunsa part samaz nahi aa raha ye batao ge jara? 😅
29th Mar 2020, 5:27 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
Jitendra Kumar Part 1 of 5. Bhai sabse pehle ye samajlo ki hum function use kyu karte hai. Function use karne ka yah fayda hai ki hame same code baar baar likhna nahi padta. Koi task agar repeatedly karna hota hai to uska logic ham ek function me define karte hai. Tumhare diye hue example me square naam ka ek function define kiya hua hai. ye function ek integer value accept karta hai aur uska square return karta hai. Ye ek simple example hai par ham aur bhi complex functions define kar sakte hai aur jab jarurat hau tab call kar sakte hai. Is se hame vahi code baar baar nahi likhna padta.
30th Mar 2020, 10:19 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
0
Bhai isme kuch v Samaj nahi aaya
30th Mar 2020, 7:42 AM
Jitendra Kumar
Jitendra Kumar - avatar
0
Kya aap function Sikhs skte Ho mujhe
30th Mar 2020, 7:45 AM
Jitendra Kumar
Jitendra Kumar - avatar