עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

מנסה לעשות quickSort גנרי ולא מצליח...

Featured Replies

פורסם

void quickSort(void *arr, int lo, int hi ,int(*comperison)( void *, void *) ){

// lo is the lower index, hi is the upper index
// of the region of array a that is to be sorted
int i=lo, j=hi;
void* x=arr[(lo+hi)/2]; זה עושה לי שגיאה כאן..משהו בשימוש לא נכון ב void

// partition
do
{
while ((*comperison)( x, arr[i])==1) i++; ובשתי ה while
while ((*comperison)( arr[j], x)==1) j--;
if (i<=j)
{
h=a[i]; a[i]=a[j]; a[j]=h;
i++; j--;

פורסם

אם p הוא מצביע (נגיד מטיפוס *int) אז הפעולה [p[j שקולה לפעולה (p+j)*, והטיפוס של הדבר הזה הוא int, ולא *int.

אם p הוא *void אז הטיפוס הוא "כאילו" void, אבל כיוון שאין טיפוס כזה באמת והקומפיילר לא יודע מה לעשות עם זה, קוד כזה לא יתקמפל. אם אתה רוצה לגשת לאיבר ה-i במערך כזה, אז אתה חייב לשמור עליו כמצביע, ולכן אסור לך להשתמש ב-[] ובמקום זה אתה צריך להשתמש באריתמטיקה של מצביעים. חוץ מזה, אתה צריך לדעת מה גודל הטיפוס ש-arr מצביע עליו - על מנת לדעת כמה צריך להוסיף לו (לדוגמה, אם p הוא *int אז הקומפיילר יודע שכשעושים p+1 אז צריך בעצם להוסיף ל-p הוא הגודל של int, שהוא בד"כ 4 או 8. לעומת זאת אם p הוא *short אז הקומפיילר יודע כשעושים p+1 אז צריך להוסיף ל-p את הגודל של short, שהוא רק 2 בד"כ. אבל אם p הוא *void אז הקומפיילר לא יודע כמה להוסיף, משום שאין לו טיפוס שהוא יכול להשתמש בגודל שלו).

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.