Save in matrix [closed]

0

How do I save letter by letter of the new word in a matrix?

#include<stdio.h>
int main()
{
    int  i=0,j,arr[26]={},temp;     
    char  s[10],arr1[10],*p;      
    printf("Enter the string\n");
    scanf("%s",s);
    p=s;
    while(*p!='
#include<stdio.h>
int main()
{
    int  i=0,j,arr[26]={},temp;     
    char  s[10],arr1[10],*p;      
    printf("Enter the string\n");
    scanf("%s",s);
    p=s;
    while(*p!='%pre%')
         {
            temp=((*p)>92)?(*p)-'a':(*p)-'A';
            if(arr[temp]==0)              
              {
                 arr1[i]=temp+'a';
                 arr[temp]=1;         
                 i++;
              }
            p++;                          
         }
    for(j=0;j<i;j++)
        {
           printf("%c",arr1[j]);
        }
    return 0;
}
') { temp=((*p)>92)?(*p)-'a':(*p)-'A'; if(arr[temp]==0) { arr1[i]=temp+'a'; arr[temp]=1; i++; } p++; } for(j=0;j<i;j++) { printf("%c",arr1[j]); } return 0; }
    
asked by Maria Diaz 26.06.2017 в 04:03
source

1 answer

0

Since you have not specified anything, it occurred to me to make the vaguest and simplest example in C. Your variables have names so rare that I doubt that you can understand what your program does, have good practice and make your code readable , and keep practicing. I recommend reading the book of the Bible of C, "the language C by kernighan and ritchie"

#include "stdio.h"

int main() {
    //insertas las filas y las columnas de la matriz
    int filas, columnas;
    scanf("%d %d", &filas, &columnas);

    //creas la matriz de caracteres
    char arreglo[filas][columnas], letra;

    //insertamos letras(caracteres) no palabras
    for (int i = 0; i < filas; i++) {
        for (int j = 0; j < columnas; j++) {
            printf("Ingresa una letra: \n");
            scanf("%c", &letra);
            arreglo[i][j] = letra
        }
    }

    //imprimimos la matriz
    for (int i = 0; i < filas; i++) {
        for (int j = 0; j < columnas; j++) {
            printf("%c", arreglo[i][j]);
        }
        printf("\n");
    }
}
    
answered by 26.06.2017 / 10:31
source