Skip to content

[QUESTION] Initializing large arrays #6990

Open
@elsonkurian1991

Description

@elsonkurian1991

Let us suppose I have a large array and that I need to initialize it with inputs. It seems that the only way to do it is by explicitly initializing every member, e.g.

int x[100];
__CPROVER_INPUT("x[0]", x[0]);
...
__CPROVER_INPUT("x[99]", x[99]);

It would be nicer to do something like:

int x[100];
char name[10];
for (int i = 0; i < 100; ++i) {
    sprintf(name, "x[%d]", i);
    __CPROVER_INPUT(name, x[i]);
}

but this does not work (__CPROVER_INPUT accepts only string constants as names, and there is no model of sprintf anyways). Is there any way to initialize the members of an array in bulk?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions