Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Why didnt run like correctly?

0 votes
asked Oct 20, 2018 by anonymous
#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

#include <time.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

void maksimum(int dizi[]){

int max;

 int boy = sizeof(dizi)/sizeof(int);  // dizinin uzunluğu

    max = dizi[0];

    

    printf("%d\n",boy);

    int i;

    for( i=1; i < boy;  i++)

    {

        if(dizi[i] > max)  // eğer dizinin i. elemanı, max'tan büyükse

        {

            max = dizi[i]; // max artık dizinin i. elemanına eşit olsun.

        }

    }

    printf("En büyük eleman %d\n",max);

}

int main(int argc, char *argv[]) {

int dizi[] = {4,2,8,9,1,4,66,4,25,75};   //diziyi oluştur

int i=sizeof(dizi)/sizeof(dizi[0]);

printf("%d\n",i);

/*

    int boy = sizeof(dizi)/sizeof(dizi[0]);

    

// int olarak tanımlanan dizinin boyutunun bulunması

// boy = tüm dizinin boyu / bir elemanın boyu;

// Örnek dizi:

// "int dizi[11] = {4,6,2,8,9,1,4,66,4,25,75};"

// Yol1:     "int boy = sizeof(dizi)/sizeof(int);" Dizi "int" olduğu için "int"'e bölündü.

// Yol2:     "int boy = sizeof(dizi)/sizeof(dizi[0]);"

printf("%d \n", boy);

*/

maksimum(dizi);

system("pause");

return 0;

}

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...