Home / Programs / Function এবং Pointer ব্যবহার করে সংখ্যার Cube নির্ণয়
🚀 Programming Example

Function এবং Pointer ব্যবহার করে সংখ্যার Cube নির্ণয়

👁 0 Views
💻 Practical Program
📘 Step Learning
Learn this program step-by-step with algorithm, source code, output and detailed explanation.

📌 Information & Algorithm

  1. একটি function তৈরি করুন।
  2. Function এ pointer parameter ব্যবহার করুন।
  3. Pointer dereference করে সংখ্যার cube বের করুন।
  4. মূল ভ্যারিয়েবলে মান update করুন।
  5. ফলাফল প্রিন্ট করুন।

💻 Program Code

#include <stdio.h>

void cube(int *num)
{
    *num = (*num) * (*num) * (*num);
}

int main()
{
    int n = 5;

    cube(&n);

    printf("Cube = %d", n);

    return 0;
}
                        

🖥 Program Output

Cube = 125
                            

📘 Explanation

Function এ Pointer parameter পাঠানো হয়েছে। Pointer dereference করে মূল ভ্যারিয়েবলের মান পরিবর্তন করা হয়েছে।

📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.