What is the problem with this code :
struct Counter { int count; }; void increment(Counter c) { c.count += 1; } int main() { Counter clock = {1}; increment(clock); }
we cannot define a struct with only one attribute
struct
the clock variable must actually be instantiated like this : Counter clock {1};
clock
Counter clock {1};
the clock variable is not modified by the increment function
increment
the main function does not have a return statement
main
return