Skip to main content

Computer science

CS

Comments

Popular posts from this blog

C language

               C  Pointers       
  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=...

C language

How to use a pointer pointer එක භාවිතා කරන ආකාරය                                           int myAge = 23; - අපිට ඕනේ  කරනවා myAge variable එකේ address එක හොයාගන්න. දැනටමත් අපි දන්නවා "&" operate එක භාවිතා කරල ඒක බලාගන්න පුළුවන් කියලා. පහල දාලා තියනවා ඒකට අදාල code එක.                                             printf(" address of myage     %p\n", &myAge); pointer එකක් භාවිතයෙන් variable  එකක address එක ගබඩා කර ගැනීම                                    int myAge = 23;  -  මේ variable එකේ නම myAge ,    data type එක intiger         ...