Question: Hello this is C programming I am working through Udemy tutorial but am getting confused with why instead of passing a pointer as the definition

Hello this is C programming I am working through Udemy tutorial but am getting confused with why instead of passing a pointer as the definition suggest below in #2(everything works I am just trying to understand with deeper understanding instead of following blindly why it works in this manner) we pass a function http_server_jquery_handler instead of (*http_server_jquery_handler). This is confusing because the second parameter seems to follow the synatx correctly as (httpd_req_t *r) is essentially the same as (httpd_req_t *req). Why doesnt the first part follow the synatx?

#1Hello this is C programming I am working through Udemy tutorial but

Below is the definition of the .handler data member of the struct httpd_uri_t

#2am getting confused with why instead of passing a pointer as the

definition suggest below in #2(everything works I am just trying to understand

httpd_uri_t jquery_js ={ . uri ="/ jquery-3.3.1.min.js", . method = HTTP_GET, . handler = http_server_jquery_handler, .user_ctx = NULL /** Handler to call for supported request method. This must return ESP_OK, or else the underlying socket will be closed / esp_err_t (*handler)(httpd_req_t r); static esp_err_t http_server_jquery_handler(httpd_req_t req) \{ ESP_LOGI(TAG, "Jquery requested"); httpd_resp_set_type(req, "application/javascript"); //Notice h httpd_resp_send(req, (const char*) jquery_3_3_1_min_js_start, jqu return ESP_OK; httpd_uri_t jquery_js ={ . uri ="/ jquery-3.3.1.min.js", . method = HTTP_GET, . handler = http_server_jquery_handler, .user_ctx = NULL /** Handler to call for supported request method. This must return ESP_OK, or else the underlying socket will be closed / esp_err_t (*handler)(httpd_req_t r); static esp_err_t http_server_jquery_handler(httpd_req_t req) \{ ESP_LOGI(TAG, "Jquery requested"); httpd_resp_set_type(req, "application/javascript"); //Notice h httpd_resp_send(req, (const char*) jquery_3_3_1_min_js_start, jqu return ESP_OK

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!