J
Joakim Hove
Hello,
I am considering to write a function like this:
enum shape_enum {circle , rectangle};
const char * shape_name(enum shape_enum shape_id) {
if (shape_id == circle)
return "Circle";
else if (shape_id == reactangle)
return "Rectangle";
end
printf("The name of the shape is: %s \n",shape_name(shape_id));
But I am wondering what happens to the memory allocated(??) for the
strings "Rectangle" and "Circle". Can I exhaust my available memory by
calling shape_name() sufficiently many times?
Regards
Joakim Hove
I am considering to write a function like this:
enum shape_enum {circle , rectangle};
const char * shape_name(enum shape_enum shape_id) {
if (shape_id == circle)
return "Circle";
else if (shape_id == reactangle)
return "Rectangle";
end
printf("The name of the shape is: %s \n",shape_name(shape_id));
But I am wondering what happens to the memory allocated(??) for the
strings "Rectangle" and "Circle". Can I exhaust my available memory by
calling shape_name() sufficiently many times?
Regards
Joakim Hove