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

תוכנית לא מובנת בנושא שילוב טיימרים ברשי&#1502

Featured Replies

פורסם

שלום,

אני די חייב עזרה בתוכנית הזו ויש כמה דברים שהייתי שמח להבין בה..

אני יודע בגדול מה היא אמורה לעשות אבל אני לא מבין למשל בפונק': add_timer מהו האובייקט השני שהיא מקבלת אחרי sec

כמו כן לא זכור לי שלמדתי מה הכוונה בביטוי כמו:

new_timer->time=sec

אני יודע מה הכוונה ב-* לא ב- <-.

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


typedef void(*fun_t)(void);

typedef struct timer_s{
int time;
fun_t fun;
struct timer_s* next;
}timer;

timer* head=NULL;

void add_timer(int sec, fun_t fun)
{
timer* curr,*new_timer;
new_timer=(timer*)malloc(sizeof(timer));
new_timer->time=sec;
new_timer->fun=fun;
new_timer->next=NULL;

curr=head;
if(curr==NULL)
{
head=new_timer;
return;
}
while((curr->next!=NULL)&&(curr->next->time<sec))
curr=curr->next;

new_timer->next=curr->next;
curr->next=new_timer;

return;
}

void run_timers()
{
int elapsed=0;
timer* tmp;

while(head)
{
Sleep((head->time-elapsed)*1000);
elapsed=head->time;
head->fun();
tmp=head;
head=head->next;
free(tmp);
}
return;
}


תודה רבה רבה רבה :)

פורסם
  • מחבר

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

מה בנוגע לשאר השאלות ?

תודה :)

פורסם

לא זהה, אבל דומה.

ו"שאר השאלות":

לשאלתך הראשונה - זה מצביע לפונקציה. אם אתה לא מכיר את הנושא, תלמד עליו.

פורסם
  • מחבר

ערכתי לפני שענית, כנראה היה לאג לתשובה שלך שלא הגיעה מקודם... לא משנה...

בכל מקרה, למה דומה ולא זהה? מה ההבדלים ביניהם ?

תודה.

פורסם

יש שם בדיוק דוגמה. זה:

ptr_to_t->y

זהה לזה:

(*ptr_to_t).y

ארכיון

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

דיונים חדשים

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.