#include #include #include // Let's define a constant #define SIZE 20 // Let's define our structure typedef struct s1 { long ts; char location[SIZE]; int temp; } Reading; // -------------------------------------------------- // Here we are passing a COPY of the structure Reading void modify_copy(Reading r) { r.temp = 68; } // -------------------------------------------------- // Here we are passing a pointer to a structure Reading void modify_original(Reading* r) { r->temp = 68; } // -------------------------------------------------- int main(int argc, char** argv) { Reading item = {10, "XXAAACC", 74}; printf("Initial sample is (%ld,%s,%d)\n",item.ts,item.location,item.temp); modify_copy(item); printf("After modify_copy: (%ld,%s,%d)\n",item.ts,item.location,item.temp); modify_original(&item); printf("After modify_original: (%ld,%s,%d)\n",item.ts,item.location,item.temp); return 0; }