SHARE
TWEET

Untitled

a guest Jul 16th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. char* reader() {
  5.     char buffer[1000];
  6.     scanf("%999s", &buffer);
  7.  
  8.     int len = strlen(buffer) + 1;
  9.  
  10.     char *text = (char *) malloc(len * sizeof(char));
  11.  
  12.     strncpy(text, buffer, len);
  13.     return text;
  14. }
  15. int main(){
  16.  
  17.    int size ;
  18.    printf("\nEingabe der Groesse des Arrays:");
  19.    scanf("%d",&size);
  20.    char *A ;
  21.    A = (char*)malloc(size* sizeof(char));
  22.    printf("\n Gib deine Zeichenkette ein: ");
  23.    int i ;
  24.    for (i=0 ; i < size ; i++)
  25.         scanf("%d",&A[i]);
  26.         A[i] = reader();
  27.  
  28.    printf("\n Deine Eingaben waren : \n") ;
  29.    for (i=0;i<size;i++)
  30.        printf("%c\n",A[i]);
  31.  
  32.    return 0 ;
  33.  
  34.  
  35.  
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top