עבור לתוכן
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.

int special_diagonal( int **arr, int size, int length, int sum) C languge

Featured Replies

פורסם

היי חברים

מישהו יכול להסביר לי בבקשה מה זה פויינטר לפויינטר ?

הפונקציה אמורה

מקבלת מערך דו מימדי ריבועי arr בגודל size, ומחזירה:

1 אם סכום אברי האלכסון, שאורכו length, וכיוונו מימין למעלה לשמאל למטה, שווה ל sum

כתבתי פה משהו


#include <stdio.h>
#include <stdlib.h>


int special(int **arr,int size,int length,int sum)
{
int newsum=0;
int i,j=0;

for(i=length;i>0;--i)
{
newsum+=arr[i][j];
j++;
}
if(newsum==sum)
return 1;
else
return 0;
}


int main(){



int a[][3]={9,8,7,6,5,4,3,2,1};


printf("%d",special(a,3,2,14));
return 0;
}

אני יודע שיש שגיאה בהפעלת הפונקציה... אבל למרות זאת זה מתקמפל

ישמח לעזרה :xyxthumbs:

פורסם

ערוך בבקשה את הכותרת כך שתכיל את תמצית השאלה. אי אפשר להבין מה השאלה רק מהחתימה של הפונקציה.

ארכיון

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

דיונים חדשים

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.