Functions
Ek function ka ek return type, ek naam, aur parameters ki ek list hoti hai. C mein parameters hamesha value se pass hote hain — function ko har argument ki apni copy milti hai, isliye function ke andar changes caller ke variable ko asar nahi karte (ek pointer pass karna, jo do lessons baad ayega, isse bachne ka tarika hai).
main.c
Khud try karo →#include <stdio.h>
int multiply(int a, int b) {
return a * b;
}
int main() {
printf("%d\n", multiply(6, 7));
return 0;
}Output
42
Aage: arrays — C ka fixed-size, no-bounds-checking collection type.
Practice exercise
Ek function multiply(int a, int b) likhein jo a * b wapas kare, phir multiply(6, 7) print karein.