Untitled
unknown
c_cpp
2 years ago
899 B
10
Indexable
void sort(struct example structExample[]) {
struct example temp;
for (int i = 0; i < Number - 1; i++)
{
for (int j = 0; j < Number - i - 1; j++)
{
if (structExample[j].example > structExample[j + 1].example)
{
temp = structExample[j];
structExample[j] = structExample[j + 1];
structExample[j + 1] = temp;
}
}
}
}
//printf scanf kanonika
//ta strings theloun char array px char onoma[50]
//example struct
struct example {
int varEx1;
char onoma[50];
double varEx2;
};
//pass to functions
void exampleFunction(struct example structExample[]);
//2d arrays always need second dimension size;
void exampleFunction2D(int example[][2])
//pass from main
exampleFunction(structExample);
//for strings
strcpy(example.name, name);
Editor is loading...
Leave a Comment