Diğer programlama dillerinde olduğu gibi C programlama dilinde de fonksiyonlar en önemli konulardan birisidir. Programlama dilleri içinde fonksiyonlar temel yapı taşıdır.
Fonksiyonlar büyük bir programı küçük parçalara bölmemizi ve daha basit küçük parçalar halinde kod yazmamızı sağlar.
Fonksiyonların genel yapısı şu şekildedir:
dönüştipi fonksiyon_adı (parametreler-zorunlu değil-)
{
işlem1;
işlem2;
...
}
Dönüş tipi : Eğer fonksiyon bir değer geri döndürecekse değerin ( int , float vs.) tipi belirtilir. Yani fonksiyonun geri döndüreceği değişkenin türü int ise fonksiyonun dönüş tipi de int olmalıdır. Eğer değer döndürmeyecekse dönüş tipi void olmalıdır. Bu değerler return deyimi ile döndürülür.
Parametreler: Parametreler fonksiyona ana program tarafından gönderilen uygun veri tipinde değerlerdir. Fonksiyon ana programdan gelen değeri alarak işlemler yapar.
Fonksiyonları genel olarak 2 başlık altında inceleyeceğiz.
Değer Döndürmeyen Fonksiyonlar
Bu tür fonksiyonlar ana program tarafından çalıştırılır fakat ana programa bir değer döndürmezler.
Bu yüzdem bu tür fonksiyonlar veri tipi olarak boş anlamına gelen void kelimesini kullanırlar.
Parametresiz
Değer döndürmeyen ve parametresiz fonksiyonlara örnek verelim. Örneğin, ekrana sadece “KOD BLOKLARI” yazan fonksiyonun ne değer döndürmesine ne de parametre almasına gerek yoktur.
#include <stdio.h>
void merhaba()
{
printf("KOD BLOKLARI");
}
main()
{
merhaba();
}
Fonksiyon hiçbir değer döndürmediği için dönüş tipi void olmuştur.
Kodun çıktısı şu şekildedir:

Şimdi de farklı bir örnek yapalım. Kullanıcıdan iki sayı alıp bu sayıları ekrana yazdıran bir fonksiyon yazalım.
#include <stdio.h>
void topla()
{
int sayi1;
int sayi2;
printf("1.Sayiyi giriniz: ");
scanf("%d",&sayi1);
printf("2.Sayiyi giriniz: ");
scanf("%d",&sayi2);
printf("Sayilarin toplami %d dir",sayi1 + sayi2);
}
main()
{
topla();
}
Bu fonksiyonda da ana programa herhangi bir değer döndürmediği için dönüş tipi void olmuştur. Ana programdan gönderilmesi gereken bir değer olmadığı için parametre kullanmadık.
Kodun ekran çıktısı şu şekildedir:

Değer döndürmeyen ve parametresiz fonksiyonlar en basit haliyle bu şekildedir.
Parametreli
Bazı durumlarda ana programdan fonksiyonlara, fonksiyonlarda kullanılmak üzere değer göndermesi gerekebilir. Bu değer gönderme işini fonksiyonlarda parametre yardımıyla yapıyoruz.
Örneğin ana programdaki 2 sayıyı fonksiyon yardımıyla toplamak istediğimiz zaman, fonksiyonların bu sayıyı bilmesi gerekir yani ana programdaki o 2 sayıyı fonksiyona göndermemiz gerekir. Bunu da parametre yardımı ile yapacağız.
#include <stdio.h>
void topla(int sayi1, int sayi2)
{
printf("Sayilarin toplami %d dir",sayi1 + sayi2);
}
main()
{
topla(12,6);
}
Yukarıda bahsettiğim gibi, ana program tarafından fonksiyona 12 ve 6 sayını gönderdik. Bu gönderilen değerler int veri tipinde olduğu için parametrelerin veri tipide int olmalıdır. Daha sonra fonksiyon bu sayıların toplamını ekrana yazdırdı. Yine herhangi bir değer döndürmediği için fonksiyonun dönüş tipi void oldu.
Kodun ekran çıktı şu şekildedir:

Değer döndürmeyen fonksiyonlar genel itibarıyla bu şekildedir.
Değer Döndüren Fonksiyonlar
Değer döndüren fonksiyonlarda, fonksiyon tarafından üretilen değer return ifadesi ile ana programa ya da çağrıda bulunan fonksiyona döndürülür.
Yukarı da yaptığımız topla fonksiyonunu değer döndüren fonksiyon haline getirelim. Yani ana programdan topla fonksiyonuna 2 sayı gönderelim. Topla fonksiyonu da bu sayıları toplayıp sonucunu ana programa döndürsün.
#include <stdio.h>
int topla(int sayi1, int sayi2)
{
int toplam;
toplam = sayi1 + sayi2;
return toplam;
}
main()
{
int sonuc;
sonuc = topla(12,24);
printf("toplam = %d",sonuc);
}
Burada ana program topla fonksiyonuna iki sayı gönderdi ve topla fonksiyonu bu değerleri topladı ve ana programa döndürdü. Yani topla(12,24) yazdığımız zaman topla fonksiyonu bize 36 değerini verir. Biz de ana programda “sonuç” değişkenini eşitledik bu değeri.
Döndürdüğümüz değer int türünde olduğu için fonksiyonun dönüş tipide int oldu.
Kodun ekran çıktısı aşağıdaki şekildedir:

Şimdi de bölme işlemi yapan fonksiyon yapalım ve bu fonksiyonda döndürülen değer float veri tipinde olacağı için fonksiyonun dönüş tipi de float olmalıdır.
Kodu şu şekildedir:
#include <stdio.h>
float bol(float sayi1, float sayi2){
float sonuc;
sonuc = sayi1 / sayi2;
return sonuc;
}
main()
{
float sonuc;
sonuc = bol(10,3);
printf("Islemin sonucu %f dir",sonuc);
}
Dönüş tipimiz, ana programa döndürülecek veri tipinde aynı olmalıdır. Bu yüzden fonksiyonumuzun dönüş tipi float olmuştur.
Kodun ekran çıktısı aşağıdaki gibidir:

Şimdi de son olarak tüm bunları kullanarak bir örnek yapalım.
Sınıftaki öğrencilerin dersten geçip geçmediğini bulan bir program yazalım. Bu programda öğrencilerin ortalamasını tek tek hesaplamak yerine bir tane fonksiyon oluşturacağız. Bu fonksiyona vize ve final notunu göndereceğiz. Fonksiyonda bize dersten geçip geçmeyeceğini söyleyecek.
#include <stdio.h>
void nothesapla(float vize, float final)
{
float puan = (vize * 0.4) + (final * 0.6);
printf("Notunuz = %f\n",puan);
if(puan > 60){
printf("Dersi gectiniz.");
}
else if (puan > 50){
printf("Dersi sorumlu gectiniz.");
}
else{
printf("Dersten kaldiniz.");
}
}
main()
{
nothesapla(60,75);
}
notHesapla() fonksiyonumuz, ana program tarafından gönderilen iki sayıyı kullanarak öğrencinin ortalamasını buldu ve dersten geçip geçmediğini hesapladı.
Kodun ekran çıktısı şu şekildedir:

Fonksiyonları kullanarak çok fazla örnek yapabiliriz. Konuyu örnekler yaparak daha iyi kavramak için C Programlama Dili Örnekleri sayfasında 52‘ den 58. soruya kadar olan örnekleri çözebilirsiniz
95 Yorum
notların devamı olacak mı
çok anlaşılır ve kısaydı teşekkürler, devamı olursa güzel olur
Appreciate it for helping out, wonderful information.
This site is really a walk-by for all the information you needed about this and didn’t know who to ask. Glimpse here, and you’ll undoubtedly uncover it.
fenofibrate 160mg for sale generic tricor 200mg tricor 160mg brand
tadalafil 5 mg tablet sildenafil drug real viagra
ketotifen without prescription geodon price tofranil 75mg drug
cost minoxytop ed pills where to buy cheap ed pills
brand precose micronase 5mg canada buy griseofulvin medication
aspirin order order aspirin 75mg for sale order zovirax online
It’s appropriate time to make some plans for the future and it’s time to be happy. I have read this post and if I could I wish to suggest you some interesting things or tips. Perhaps you could write next articles referring to this article. I desire to read even more things about it!
dipyridamole uk order dipyridamole 25mg generic pravastatin 10mg drug
buy meloset 3 mg sale danocrine cheap danocrine 100mg ca
dydrogesterone 10 mg us forxiga 10 mg cheap jardiance price
florinef where to buy imodium order online imodium 2mg usa
generic etodolac 600mg buy generic monograph for sale pletal medication
cheap prasugrel brand chlorpromazine 50 mg tolterodine generic
oral pyridostigmine order rizatriptan 10mg generic buy rizatriptan 10mg online cheap
cost ferrous 100 mg buy ascorbic acid 500 mg online cheap buy sotalol 40mg
vasotec 10mg drug brand bicalutamide buy generic duphalac
brand xalatan xeloda over the counter buy rivastigmine 6mg online
betahistine order online betahistine generic buy probalan medication
premarin over the counter cabergoline 0.25mg brand order viagra 100mg pill
buy omeprazole 10mg generic omeprazole 10mg price metoprolol canada
buy tadalafil sale brand sildenafil 50mg sildenafil for men
micardis 20mg usa plaquenil oral order molnupiravir 200mg pill
purchase cenforce generic naprosyn 500mg pill order chloroquine generic
buy provigil for sale order modafinil deltasone pills
buy cefdinir pill generic glycomet 500mg buy lansoprazole 30mg for sale
where can i buy isotretinoin amoxicillin oral azithromycin for sale online
azithromycin 250mg canada buy neurontin 100mg generic cost gabapentin 800mg
brand atorvastatin 40mg order norvasc 10mg purchase amlodipine sale
online casino real money usa recommended you read cheap furosemide 40mg
order pantoprazole without prescription lisinopril 10mg uk phenazopyridine online order
planning poker online albuterol 4mg cheap buy generic ventolin online
best online casino for real money order stromectol 6mg online ivermectin 3 mg
symmetrel 100mg drug amantadine 100 mg oral aczone online
online casino games oral amoxiclav buy synthroid 75mcg for sale
buy clomiphene for sale buy isosorbide 20mg sale cheap azathioprine 50mg
buy methylprednisolone without prescription triamcinolone ca how to get triamcinolone without a prescription
vardenafil online order tizanidine for sale generic tizanidine
coversum usa order allegra 180mg for sale fexofenadine cost
dilantin ca purchase cyclobenzaprine without prescription buy cheap generic oxybutynin
Mnoho hráčů však mnohem raději hraje o skutečné výhry. Přece jen někdo hledá hlavně vzrušení a podmanivý pocit z možných reálných výher. V tomto případě je důležité myslet na zodpovědnou hru a určitě se pokusit využít všech výhod a benefitů. Jedním z nich jsou registrační bonusy zdarma. Díky nim si lze zahrát hrací automaty o skutečné výhry, aniž by do online casina musel vkládat finanční prostředky. To bohužel není možné. Kdybyste chtěli získat jeden bonus dvakrát, museli byste se do online casina zaregistrovat znovu. Jenže to nejde. Pokud se registrujete do online casina, zadáváte své údaje včetně jména, adresy a rodného čísla. Online casina mají databázi svých hráčů a opakovanou registraci toho samého člověka nepovolují. Zároveň je během registrace potřeba ověření údajů, takže ani na vymyšlené údaje další bonus nedostanete.
https://bookmarksden.com/story15272295/vyherni-automaty-na-prodej
ABBINAMENTI: A tutto pasto, ben si abbina a ricchi piatti della cucina mediterranea. Da provare con una grande paella valenciana. La nostra azienda Do il mio consenso affinché un cookie salvi i miei dati (nome, email, sito web) per il prossimo commento. Giallo paglierino, delicato e luminoso, ha aromi chiari e tipici di agrumi, mela, pera e pesca, note erbacee, fiori selvatici e sfumature minerali gessose. Corrispondente al palato, è fresco, sapido ed equilibrato. Chiusura degli agrumi. Accedi tasca d’almerita Spedizioni gratuite in Italia per ordini superiori ai 120€ Camera di Commercio di Milano REA MI-1952265 Ideale per i vini bianchi leggeri e di media struttura, che non necessitano di ossigenazione per aprirsi. L’apertura leggermente più stretta rispetto al corpo del calice favorisce la concentrazione dei profumi verso il naso, esaltando la percezione degli aromi e limitandone la dispersione
purchase baclofen online cheap buy ketorolac sale toradol where to buy
claritin canada priligy 90mg cheap cheap dapoxetine 30mg
В поисках идеального казино для игры на деньги, я обратился к Яндексу, и на первом месте вышел сайт caso-slots.com. Там я обнаружил множество различных казино с игровыми автоматами, а также бонусы на депозит. К тому же, на сайте есть полезные статьи о том, как правильно играть, чтобы увеличить свои шансы на победу!
oral baclofen 10mg elavil 10mg without prescription order toradol generic
order glimepiride 1mg sale glimepiride sale buy etoricoxib sale
buy cheap fosamax order macrodantin 100mg sale nitrofurantoin 100 mg oral
propranolol brand purchase clopidogrel clopidogrel oral
order pamelor 25 mg pills buy pamelor tablets acetaminophen medication
purchase warfarin for sale brand coumadin 5mg order metoclopramide 20mg online
buy xenical for sale diltiazem 180mg without prescription diltiazem order
generic famotidine 40mg buy hyzaar without a prescription tacrolimus 1mg price
buy azelastine 10ml nasal spray irbesartan 150mg canada buy irbesartan online
nexium online buy mirtazapine 15mg price order generic topiramate 100mg
order sumatriptan 50mg without prescription buy levaquin 250mg pills where to buy dutasteride without a prescription
buy generic allopurinol 300mg buy crestor 10mg sale buy rosuvastatin 20mg
buy zantac 150mg without prescription buy zantac online cheap celecoxib oral
buspar cheap cordarone for sale online buy amiodarone without a prescription
buy flomax 0.2mg purchase tamsulosin generic buy cheap zocor
motilium uk buy motilium generic sumycin sale
aldactone usa buy valacyclovir 500mg for sale order finasteride 5mg pills
help with essay writing best website for writing essays affordable essays
order forcan pill buy fluconazole medication order cipro 500mg online cheap
order aurogra sale buy sildalis generic yasmin order
buy flagyl sale flagyl for sale brand keflex 125mg
cost cleocin fildena cost best ed pill
buy retin gel generic avanafil 100mg oral buy avanafil 100mg generic
nolvadex uk nolvadex 20mg pill rhinocort order
tadalafil medication purchase indomethacin capsule indocin 50mg cheap
how to buy cefuroxime order ceftin without prescription buy robaxin for sale
desyrel order online buy suhagra 100mg pills purchase clindamycin sale
order lamisil 250mg generic casino money san manuel casino online
buy aspirin 75mg pills online casino real money payouts spins real money online
writing dissertation service order generic cefixime 100mg suprax canada
best college paper writing service help me with my paper legitimate online slots for money
trimox oral amoxicillin 250mg for sale buy biaxin generic
generic rocaltrol 0.25 mg cheap trandate 100mg order fenofibrate 200mg pills
purchase catapres online order tiotropium bromide 9 mcg generic buy spiriva 9 mcg online cheap
how to get rid of body acne fast buy trileptal without prescription trileptal over the counter
There are several platforms built to address inter-entity payment settlements that could help Treasury pilot such an effort. They allow for internal transfers from department to department and help ensure the real-time balancing of the company’s global payment system. Some companies think of the pilot this way: It’s a bit like a contrast dye that enables a radiologist to see the internal organ or tissue of a patient by making it more visible against the background of other tissues. So, too, with a crypto pilot. The piloted crypto, like a contrast dye, can help isolate and identify the potential opportunities and roadblocks to the broader adoption of crypto by the company. The 2014 documentary The Rise and Rise of Bitcoin portrays the diversity of motives behind the use of bitcoin by interviewing people who use it. These include a computer programmer and a drug dealer. The 2016 documentary Banking on Bitcoin is an introduction to the beginnings of bitcoin and the ideas behind cryptocurrency today.
http://fuelregulations.com/forum/profile/cretaratan1975/
What that shows is just how heavily the mix of assets is skewed toward a meme-y token called shiba inu (SHIB), a digital asset built atop the Ethereum blockchain that was largely inspired by the joke token dogecoin (DOGE). Like DOGE – a key staple of billionaire Elon Musk’s crypto schtick on Twitter – the SHIB token is a highly volatile cryptocurrency whose primary use case is often considered to be speculation itself; it’s traded for fast profits and yuks. More recently, BONE bagged a listing on the prominent South Korean exchange Gate.io and also Huobi. After Crypto, the community hopes to see the asset on Binance. A petition for the same has been making the rounds and currently has 2,029 signatures. Learn more about Consensus 2024, CoinDesk’s longest-running and most influential event that brings together all sides of crypto, blockchain and Web3. Head to consensus.coindesk to register and buy your pass now.
order minocin 50mg generic cost requip 2mg requip 1mg brand
order alfuzosin 10 mg sale strongest gerd prescription medication best homeopathic remedy for acidity
order sleep meds online fda approved hair removal devices where to buy ozempic injection
letrozole usa order albendazole online cheap buy aripiprazole for sale
fda approved smoking cessation products buy osteoporosis pills online doctors for pain medication
purchase provera online order provera online cheap hydrochlorothiazide price
antiviral medications for herpes 2 asthma inhalers over the counter type 2 diabetes lab results
buy cyproheptadine generic luvox 50mg over the counter how to buy nizoral
spices with antifungal properties herpes suppressive medication side effects how to get blood pressure down immediately with 3 exercises
duloxetine 20mg brand modafinil for sale purchase provigil
antibiotic for stomach ulcer 5 most common hypertensive medications boots online doctor login
order phenergan order promethazine 25mg generic ivermectin 6 mg over the counter