Pointer භාවිතයෙ වැදගත් අවස්ථා කලින් පාඩම් වලට අදාල ප්රශ්න දෙකක් Q 1 dynamic memory allocation භාවිතා කිරීමට හේතුව හා ඊට අදාළ function? Q 2 reference & ඔපරේටර් එක භාවිතා කිරීමට හේතුව භාවිතා කරන මූලික අවස්ථා call by reference dynamic memory allocation accessing file call by reference මේක තේරුම් ගන්න නම් පහත උදාහරණ දෙක හොඳින් බලන්න බලන්න. අගයන් දෙකක් මාරු කර ගැනීම function එකක් ලිවීම් Call by value void swap (int a, int b) // { int c; // c=a; a=b; b=c; } අදාල code එක : #include int main() { int x,y; x=8; y=80; printf(" \n value of x = %d and y = %d", x,y); swap(x,y); printf("\n after swap "); printf(" \n value of x = %d and y = %d", x,y); return 0; } void swap (int a, int b) { int c; c=...
Comments
Post a Comment