Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Any C programmers wanna help convert code to convert between MIDI + CSV?
#39
Quote:As I've tried to explain, quoted character strings can only be accessed via <column>.


That's just wrong! The names in the example are accessed through the row.

All you need to do is run the slightly expanded program. By specifying the column one can only  access individual letters .

Code: (Select All)
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int main(void)
{
    //One-dimensional array
    char namen[] = "Rio de Janeiro";
    char *zgr = namen;
    
    //Two-dimensional array
    char namenfeld[3][9] = {"Berlin", "Tokio", "Katmandu"};
    int feldnummer, zeile, spalte;
        
    printf("\n");
    while( *zgr )
    { printf("%c", *zgr++); }

    printf("\n\n");
    
    for(int i = 0; i < 3; i++)
    {
        printf("%s ", namenfeld[i]);        
    }
    printf("\n");
    
    printf("\nFeldnummer des Namesn der angezeigt werden soll (0 bis 2): ");
    scanf("%d", &feldnummer);
    printf("[%d] ist die Adresse von: %s", feldnummer, namenfeld[feldnummer]);
    
    printf("\n\nWaehle Wort und Buchstaben die angezeigt werden sollen - Zeile<>Spalte: ");
    scanf("%d %d", &zeile, &spalte);
    printf("\nBuchstabe an Position [%d][%d]: %c", zeile, spalte, namenfeld[zeile][spalte]);
    printf("\n\nBuchstabe an Position [0][5]: %c", namenfeld[0][5]);
    
    printf("\n\n");
    return(0);
}

[Image: Stringfelder.jpg]
Reply


Messages In This Thread
RE: Any C programmers wanna help convert code to convert between MIDI + CSV? - by Kernelpanic - 08-31-2022, 05:10 PM



Users browsing this thread: 22 Guest(s)