getchar - Can't understand return value of getche() C -


#include <stdio.h> #include <conio.h> #define max 30 void main() { char str[max]; char str2[max]; int i=0; char c2,c1; printf("inserire stringa 1:\n"); {     c2=getche();     if(c2<0)     {         c1=getche();     }     else     {         c1=c2;     }     str[i]=c1;     i++; }while(i<=max&&c1!='\n');  printf("\n"); i=0; printf("inserire stringa 2:\n"); {     c2=getche();     if(c2<0)     {         c1=getche();     }     else     {         c1=c2;     }     str2[i]=c1;     i++; }while(i<=max &&c1!='\n'); printf("\n"); 

}

i can't understand code does.expecially if cycle:when c2<0?what return getche function? while condition giving me problems:even if press enter doesn't esc fro cycle , overwrite first word until don't write 20 chars.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -