![]() |
declaring function that returns a structure
Hi, anyone knows why the highlighted words cause syntax errors?
Please advise. Code:
#include <stdio.h> |
Re: declaring function that returns a structure
(1) int num_a=0, num_b=0;
This one causes error because C (or C++) does not allow in-struct (or in-class) initialization of non-const static member variables. You should define the struct without initializations and then initialize num_a and num_b to 0 whenever you declare a new variable of that struct type. (2) return count( str[idx], idx); The count function you have defined : Code: CPP
But you are passing a character ... str[idx]. |
Re: declaring function that returns a structure
oo...
|
| All times are GMT +5.5. The time now is 13:40. |