Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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?

#1image text in transcribed

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

#2image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+2. How much staff time will it take to implement this tactic?

Answered: 1 week ago

Question

Solve the integral:

Answered: 1 week ago

Question

What is meant by Non-programmed decision?

Answered: 1 week ago

Question

What are the different techniques used in decision making?

Answered: 1 week ago

Question

At what level(s) was this OD intervention scoped?

Answered: 1 week ago