You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a simple code that trying to populate an array of structures, and printing the content of a structure.
Also, after that I call a function that has a structure like parameter and printing again the content of that structure.
When I build, it prints me only the first 5 elements of the structure.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a simple code that trying to populate an array of structures, and printing the content of a structure.
Also, after that I call a function that has a structure like parameter and printing again the content of that structure.
When I build, it prints me only the first 5 elements of the structure.
`#include <stdio.h>
#include <string.h>
#include <time.h>
#include <zephyr/kernel.h>
typedef struct
{
int errorCode;
char message[64];
} ErrorType;
static int myError[20] = {10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105};
static char message[20][64] = {
"Temperature sensor failure",
"Pressure sensor disconnected",
"Voltage out of range",
"Current overload detected",
"Memory access error",
"Sensor calibration required",
"Communication timeout",
"Battery level low",
"Unexpected reset detected",
"External interface failure",
"Temperature sensor1 failure",
"Pressure sensor1 disconnected",
"Voltage out of range",
"Current overload detected",
"Memory access error",
"Sensor calibration required",
"Communication timeout",
"Battery level low",
"Unexpected reset detected",
"External interface failure"
};
void reportError(const ErrorType error);
int main()
{
ErrorType Error[20];
}
void reportError(const ErrorType error)
{
printf("\n Error code : %d", error.errorCode);
printf("\n Error message : %s", error.message);
}`
Beta Was this translation helpful? Give feedback.
All reactions