DEV Community

madina1575
madina1575

Posted on

1

FUNCTIONS

  • C++ dasturlash tilida funksiya bu kodning qayta ishlatiladigan qismi bo'lib, u bir yoki bir nechta vazifalarni bajarish uchun yoziladi.

  • Funksiya boshqa joyda chaqirilganda, u bajariladi va natija qaytarilishi mumkin.

  • Funksiya ma'lum vir vazifani bajarish uchun ishlatiladigan va kodni modul qilish hamda qayta ishlatishni osonlashtiradi.

  1. Funksiyaning asosiy qismlari:
  • Funksiya turi(return type): Funksiya qanday turdagi qiymatni qaytarishi kerakligini bildiradi. Masalan: int, void, double va boshqalar.

  • Funksiya nomi (function name): Funksiyaga berilgan ism bo'lib chaqirilganda uni ishlatish uchun xizmat qiladi.

  • Parametrlar(parameters): Funksiyaga kiruvchi qiymatlar olishi mumkin. Bu qiymatlar funksiyaga berilgan argumentlar yordamida uzatiladi. Agar parametrlar kerak bo'lmasa, bo'sh qavslar yoziladi.

  • Tana qismi(function body): funksiyalar
    bajaradigan amallar bu yerda yoziladi. Qavslar {} ichiga yoziladi.

  • Qaytarish bayonoti(return statement): Funksiya natijani qaytarishi mumkin. Agar funksiya natijani qaytarishi kerak bo'lsa return bayonoti ishlatiladi. Aks holda, funksiya void bo'lishi mumkin va qaytarish talab qilinmaydi.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay