Search
 
SCRIPT & CODE EXAMPLE
 

C

how we can strore a nested structure values in arrays

typedef struct {

    char ChannelNo[3];              //"P1"
    unsigned int ChannelPin;        //23
    char State;                     //'o'
}test;

typedef struct {

    test One[3];
    test two[3];
    test three[3];
    test four[3];
    test five;
    test six[3];

}matrix;

matrix x[] =
    {
    // [0]
        {
            .One = {
                     {.ChannelNo = "P4", .ChannelPin = 23, .State = 'o'},
                     {.ChannelNo = "P1", .ChannelPin = 98, .State = 'o'},
                     {.ChannelNo = "P0", .ChannelPin = 23, .State = 'o'},
            },
            .two = {
                    {.ChannelNo = "P5", .ChannelPin = 79, .State = 'd'},
                    {.ChannelNo = "P4", .ChannelPin = 79, .State = 'e'},
                    {.ChannelNo = "P5", .ChannelPin = 79, .State = 'r'},
            },
            // ......
            .five = {.ChannelNo = "P5", .ChannelPin = 79, .State = 'r'},
        },
    // [1]
        {
            .One = {
                     {.ChannelNo = "P4", .ChannelPin = 23, .State = 'o'},
                     {.ChannelNo = "P1", .ChannelPin = 98, .State = 'o'},
                     {.ChannelNo = "P0", .ChannelPin = 23, .State = 'o'},
            },
            .two = {
                    {.ChannelNo = "P5", .ChannelPin = 79, .State = 'd'},
                    {.ChannelNo = "P4", .ChannelPin = 79, .State = 'e'},
                    {.ChannelNo = "P5", .ChannelPin = 79, .State = 'r'},
            },
            // ......
            .five = {.ChannelNo = "P5", .ChannelPin = 79, .State = 'r'},
        },
    // ......
    };
Comment

PREVIOUS NEXT
Code Example
C :: logarithmus c math.h 
C :: get multiple c 
C :: wap in c to input n numbers in an array, find out the sum of odd nos. and even nos. display the numbers whose sum is high. 
C :: c michael 
C :: what to do after autoencoder training 
C :: C #define preprocessor 
C :: how to add a number before every line in c language 
C :: laarvel artisan to create controller model miigration 
C :: Wait until an animation finishes - Selenium, Java 
C :: putting character in the begginig and end of sring C 
C :: difference between %f and %lf 
C :: how to write 2d array from bin file in c 
C :: take array input from user and calc the avr in c 
C :: c programming trinary if 
C :: print binary c 
C :: matrix of string in c 
C :: c program for determining a character is alphabet or not 
Dart :: screen size flutter 
Dart :: dart math library 
Dart :: dateTime.now addyears dart 
Dart :: switch to another flutter channel eg. $ flutter channel beta $ flutter channel stable 
Dart :: how to print in the same line in dart 
Dart :: close keyboard on button click flutter 
Dart :: dart find element in list 
Dart :: velocity x circle 
Dart :: flutter use png as icon 
Dart :: how to load folders in flutter 
Dart :: flutter dictionary example 
Dart :: extend class flutter 
Dart :: flutter alertdialog actionsoverflowdirecation 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =